Evaluate Expression to True (Memoization with 3D Array)
Hard

Problem Statement

Use a 3D array dp[i][j][t] to memoize the count of ways for substring s[i..j] to evaluate to t (0/1).

Examples

1Example 1
Input:
{ "s": "T|F&T" }
Output:
2
2Example 2
Input:
{ "s": "T^F|T" }
Output:
1
3Example 3
Input:
{ "s": "F|T^F" }
Output:
2
Loading...

Sign in to Run Code and Submit