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!!!
I didnt get you, according to what i understood in a string given for eg: <<> have to search for opening and ending brackets.
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.