Can somebody give me a testcase where my code is giving WA or tell me what is wrong in my code ?? Plz…
My sol: CodeChef: Practical coding for everyone
Thanks
Aditya
@sidhant007 @adhyyan1252 @socho @anon38711361 @vijju123_adm @taran_1407 @kuruma
Can somebody give me a testcase where my code is giving WA or tell me what is wrong in my code ?? Plz…
My sol: CodeChef: Practical coding for everyone
Thanks
Aditya
@sidhant007 @adhyyan1252 @socho @anon38711361 @vijju123_adm @taran_1407 @kuruma
For following test-cases your program is giving incorrect output:
3
<<<>
<<<<<<<>
<>>><><><>
Your Code Output:
2
2
8
Correct Output:
0
0
2
@striker22 But why in sample testcases the 3rd one’s output is 2 . I think it should be 0.
Plz explain.
Input:
3
<<>>
<
<>>>
Output:
4
0
2
Because the problem is asking you to compute the length of the longest balanced prefix.
In the 3rd one longest balanced prefix is <>
and its length is 2.
Agree, but some > tags did not have opening tags is this valid.
Read the problem statement again and carefully. A string consist of <
and >
is said to be balanced if for every <
there exist >
. The problem is asking for longest balanced prefix.
Ok now i got it. Thanks a lot.