Skip to content

Latest commit

 

History

History
73 lines (30 loc) · 1.09 KB

README_EN.md

File metadata and controls

73 lines (30 loc) · 1.09 KB

中文文档

Description

Given a boolean expression consisting of the symbols 0 (false), 1 (true), & (AND), | (OR), and ^ (XOR), and a desired boolean result value result, implement a function to count the number of ways of parenthesizing the expression such that it evaluates to result.

Example 1:

Input: s = "1^0|0|1", result = 0



Output: 2

Explanation: Two possible parenthesizing ways are:

1^(0|(0|1))

1^((0|0)|1)

Example 2:

Input: s = "0&0&0&1^1|0", result = 1



Output: 10

Note:

  • There are no more than 19 operators in s.

Solutions

Python3

Java

...