Available question text
Given a parenthesized boolean expression evaluated left-to-right (no operator precedence), compute the minimum number of single-character flips (change a literal 0↔1 or an operator &↔|) needed to make the whole expression evaluate to the opposite value. The core challenge is to parse the expression into subexpressions and use DP on the expression tree/stack to track the minimal cost to force each subtree to 0 or 1 (must handle up to 1e5 length efficiently).
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 1896. Minimum Cost to Change the Final Value of Expression
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source