Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! ![]()
2 Likes
I didn’t understand, how is <>>> a valid input (answer 2) whereas <<> is not? How are we dealing this?
Anyone? : [
For <<>:
prefixLength: prefix: is valid:
1 < false
2 << false
3 <<> false
==========
0
For <>>>:
prefixLength: prefix: is valid:
1 < false
2 <> true
3 <>> false
4 <>>> false
==========
2
2 Likes
@ssjgz what’s wrong now?! I have edited the code, added a valid flag which is set to true as soon as a closing bracket pair is found. Thanks
1 Like
Consider:
1
<><>
2 Likes
what now? xx
1
<>><>
2 Likes
Thanks very much
1 Like
What now?
1
<>><><>

2 Likes
so it’s output will be 2?
The output needs to be 2 for that test input, yes 
what about <><<<>> ?
prefixLength: prefix: is valid:
1 < false
2 <> true
3 <>< false
4 <><< false
5 <><<< false
6 <><<<> false
7 <><<<>> false
==========
2
1 Like
what now?
Hmmm … I can’t immediately find any counter-examples for that. Can you link to the failing submission?
1 Like
I finally got it right haha. Just messing with you. Thanks a lot anyways for doing this walkthrough . by the way, would you suggest a way by which you were coming with all the exceptions of the algorithm so quickly?
1 Like