← All problemsSign in

PARENTHESIS SEQUENCE

$‘(‘$ and $‘)’$ are known as parenthesis. A sequence containing parenthesis is given but it’s not in an order that you like (or maybe it is). To fix the given sequence you can move at most one parenthesis from its original place in the sequence to any other position. You cannot convert an open parenthesis into a closed one i.e. you can’t reverse a bracket. Let’s call the sequence you want a good

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start