You are given a valid boolean expression represented by a string expression that consists of the characters $'1'$, $'0'$, $'&'$, $'|'$, $'('$, and }$')'$.
The operators evaluate as follows:
$'1'$ evaluates to true, and $'0'$ evaluates to false.
$'&'$ represents the boolean AND operation, while $'|'$ represents the boolean OR operation.
Operations are evaluated from left to right, while respecting the precedence of parentheses.
In one operation, you can flip any single character:
Change a $'1'$ to a $'0'$ or a $'0'$ to a $'1'$.
Change a $'&'$ to a $'|'$ or a $'|'$ to a $'&'$.
Return the minimum number of operations required to change the final evaluated boolean value of the expression.
Constraints:
expression.length
expression only contains $'1'$, $'0'$, $'&'$, $'|'$, $'('$, and }$')'$.
All parentheses are properly matched.
There will be no empty parentheses (i.e., "()" is not a substring of expression).
You are given a valid boolean expression represented by a string expression that consists of the characters $'1'$, $'0'$, $'&'$, $'|'$, $'('$, and }$')'$.
The operators evaluate as follows:
$'1'$ evaluates to true, and $'0'$ evaluates to false.
$'&'$ represents the boolean AND operation, while $'|'$ represents the boolean OR operation.
Operations are evaluated from left to right, while respecting the precedence of parentheses.
In one operation, you can flip any single character:
Change a $'1'$ to a $'0'$ or a $'0'$ to a $'1'$.
Change a $'&'$ to a $'|'$ or a $'|'$ to a $'&'$.
Return the minimum number of operations required to change the final evaluated boolean value of the expression.
Constraints:
expression.length
expression only contains $'1'$, $'0'$, $'&'$, $'|'$, $'('$, and }$')'$.
All parentheses are properly matched.
There will be no empty parentheses (i.e., "()" is not a substring of expression).