+ 3

I was stuck at the balance parenthesis challenge, got 5 cases right out of 7, pls help needed

Balanced paranthesis challenge https://code.sololearn.com/cS2IeAZ7bkHy/?ref=app

8th Feb 2021, 10:29 PM
elvisreal
elvisreal - avatar
2 ответов
+ 2
That is because there could be an input in which the closing bracket comes first. For example: INPUT: ) Hello ( This will detect a ')' on first iteration then it will search for the index of an opening bracket '('. But since we still have no opening brackets, rindex method will raise an error. https://code.sololearn.com/c5xviIfHKXSy/?ref=app
9th Feb 2021, 2:55 AM
noteve
noteve - avatar
0
Thanks your explaination on cases where we have ) and no ( at first.
9th Feb 2021, 4:37 AM
elvisreal
elvisreal - avatar