COMPILER - DSALRN02

Problem link : CodeChef: Practical coding for everyone

I can’t understand the question clearly.

can some one provide what output should return as per the problem for the following cases.

2
<><>
<<<>>><><>

output I assume output should be

2
6

is this correct?

no Bro not atall

then 4 and 10?

1
<<>><<>

output 4 or 5 here?

[simon@simon-laptop][12:43:41]
[~/devel/hackerrank/codechef]>echo "2
<><>
<<<>>><><>" | ./a.out
prefixLength: prefix:  is valid: 
1             <        false
2             <>       true
3             <><      false
4             <><>     true
==========
4
prefixLength: prefix:     is valid: 
1             <           false
2             <<          false
3             <<<         false
4             <<<>        false
5             <<<>>       false
6             <<<>>>      true
7             <<<>>><     false
8             <<<>>><>    true
9             <<<>>><><   false
10            <<<>>><><>  true
==========
10
[simon@simon-laptop][12:44:44]
[~/devel/hackerrank/codechef]>echo "1
<<>><<>" | ./a.out
prefixLength: prefix:  is valid: 
1             <        false
2             <<       false
3             <<>      false
4             <<>>     true
5             <<>><    false
6             <<>><<   false
7             <<>><<>  false
==========
4
1 Like

Understood. Thank you.

1 Like