I tried in different ways to get the correct answer but EVERY TIME I GET WA, can anyone tell me where I am going wrong, I am really got stuck at this point and have no clue why my code is failing every time. Help would be much appreciated!!!
Its giving me output as 2 which seems to be correct. I don’t know at which Test case my code is failing. @sebastian, do you know where iam going wrong?
I didnt get you, according to what i understood in a string given for eg: <<> have to search for opening and ending brackets.
or
Is it like we have to match “<” and “>” since starting index and checking how many matches with it?
for the ex you have given: <<> output should be 0?
<<>>>>><<<<> —> output should be 4?
Am i right?
You have to find correct match from the starting index. you should tell the length of the longest prefix of each of these expressions that is valid, or 0 if there's no such a prefix. Prefix starts from the first index only.