+ 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
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
0
Thanks your explaination on cases where we have ) and no ( at first.