Evaluate Expression to True Recursive
Hard

Problem Statement

Count ways to parenthesize a boolean expression of T,F and operators &|^ so it evaluates to true, using recursion.

Examples

1Example 1
Input:
{ "s": "T|F&T", "i": 0, "j": 4, "isTrue": true }
Output:
2
2Example 2
Input:
{ "s": "T^F|T", "i": 0, "j": 4, "isTrue": true }
Output:
1
3Example 3
Input:
{ "s": "F|T^F", "i": 0, "j": 4, "isTrue": true }
Output:
2
Loading...

Sign in to Run Code and Submit