What is the brute-force intuition for Valid Parentheses?
Practice this question from Valid Parentheses - Stack matching Pattern Practice Quiz, with options and an explanation.
Question
What is the brute-force intuition for Valid Parentheses?
Option A — Correct answer
Repeatedly remove adjacent valid pairs
Option B
Sort all brackets
Option C
Use Kadane algorithm
Option D
Build a graph
Explanation
Repeatedly remove adjacent valid pairs until no more can be removed.