COMPILER PROBLEM

I’m having a hard time understanding the question.
For eg
Why is the answer to <<<> 0.
it has a valid parenthesis at indexes 2 and 3 right??

prefixLength: prefix:  is valid: 
1             <        false
2             <<       false
3             <<<      false
4             <<<>     false
==========
0
1 Like

https://www.codechef.com/viewsolution/33190822
WHERE AM I GOING WRONG?

This solution fails for the following test input:

1
<><<>
1 Like

Yep :slight_smile:

the output is 2

Not on my machine it isn’t - this solution gives:

0

I’m sorry I had two windows opened…and gave the wrong link…didnt submit the updated code… :grimacing: :grimacing:It worked! thanks

1 Like

https://www.codechef.com/viewsolution/33191211

@ssjgz what should be the correct output for <<><>> 4 or 2?

Neither - it should be 6:

prefixLength: prefix:  is valid: 
1             <        false
2             <<       false
3             <<>      false
4             <<><     false
5             <<><>    false
6             <<><>>   true
==========
6
1 Like