https://www.codechef.com/viewsolution/32647598
Please help me ,why i am getting a wrong answer?
The answer should be 0.
why ?
None of the prefixes of <<> are valid, according to the definition.
Can you explain a bit more, I am not getting it.
Does it mean than for ‘>’ we are getting two options for ‘<’ which is not valid?
The prefixes of <<> are:
1. <
2. <<
3. <<>
None of these are valid according to this definition:
For 1, there is a < but no corresponding > symbol.
Similar for 2.
For 3, there are two <'s but only one >: thus, the same > must correspond to both of the <'s, which contradicts the last sentence in the definition.
So the number of ‘<’ should be always equal to ‘>’ ?
This is necessary for a string to be valid, yes; this is implicit in the definition.
https://www.codechef.com/viewsolution/32673403
still i am getting WA ,it is giving right test on your testcase btw.
what should be the answer to this testcase.
The output for the test input:
1
<><
should be
2