Evaluate Expression To True

Given expression with operands and operators (OR , AND , XOR) , in how many ways can you evaluate the expression to true, by grouping in different ways? Operands are only true and false.
string : T|F&T^T here '|' will represent or operator '&' will represent and operator '^' will represent xor operator 'T' will represent true operand 'F' will false

different ways % MOD where MOD = 1003

string : T|F only 1 way (T|F) => T so output will be 1 % MOD = 1

Interview Code Editor
  • Hint 1
  • Solution Approach
  • Complete Solution
1061 successful submissions.
Asked In:
  • Amazon
Click here to jump start your coding interview preparation