相关疑难解决方法(0)

计算布尔括号内的实现

给定包含符号{true,false,和,或xor}的布尔表达式,计算括号表达式的方式的数量,使其计算结果为true.

例如,只有一种方法可以将'true和false xor true'括起来,使其计算结果为true.

这是我的算法

we can calculate the total number of parenthesization of a string
Definition:  
N - the total number of 
True -  the number of parenthesizations that evaluates to true
False - the number of parenthesizations that evaluates to false
True + False = N 
Left_True - the number of parenthesization in the left part that evaluates to True
same to Left_False, Right_True, Right_False

we iterate the input string from left to right and deal with each …
Run Code Online (Sandbox Code Playgroud)

algorithm implementation dynamic-programming

10
推荐指数
1
解决办法
6135
查看次数