Can somebody please give me the test case for which my code is not working?

My soln.-http://www.codechef.com/viewsolution/5895965

Hello prerakd,

Here is your AC solution for this problem â€¦

http://www.codechef.com/viewsolution/5896261

Test case :

<<<>

ans is 0 your code is producing something else. So please check â€¦

I just made some changes in your code and boom it got AC. â€¦

Edit : if you find any difficulty in understanding my submissionâ€¦ feel free to ask

you can also do it without using stack â€¦ have a look at this submission â€¦

@ma5termind Why ans for the test case<<<> is 0 and not 2?As the there is a sequence in the last (<>) so why we wouldnâ€™t count that?Also there is a similar case as sample case <>>> in which is output is 2?Why output for two are different?..And thanks for the help.

Hello prerakd,

Problem asked you to find the length of the longest prefix that is valid rightâ€¦

<<<>

for the given case, we have 4 prefixes

- <
- <<
- <<<
- <<<>

As you can see that there is not prefix which is valid. Therefore the answer to this case is zero.

for the next test case

<>>>

prefixes are

- <
- <>
- <>>
- <>>>

here second prefix is valid and is of length = 2 therefore the answer to this test case is 2.

still having some difficulty â€¦ feel free to post dear