Search
⌘K

Leetcode 2116. Check if a Parentheses String Can Be Valid

Given a parentheses string where some characters are fixed and others can be flipped, determine whether you can change the unlocked positions to form a valid parentheses sequence. The core challenge is managing the range of possible open-parenthesis balances as you scan the string (with parity/length constraints), typically solved by a linear greedy check.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.