← All problemsSign in

Good String

You are given a string S consisting only of ' + ' and ' - ' symbols. The given string S is termed as " good " string if : - There is equal no of ' + ' and ' - ' symbols. - For every valid i ( 0 ≤ i S ) the substring from S0 to Si ( i.e the string S0S1S2.........Si ) has greater than or equal number of ' + ' than ' - '. For Example, the string " ++-- " is considered to be " good " but the string

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