# which test cases my code does not satisfy.

i wrote this code but it is giving wrong answers in a few test cases . what am i doing in this code is this:-

```
take input as string
calculate length of string.
declare an array of size length +1.
store values in the array as per sign.
arr[0] is set at 1 by default.
now count the no. of unique nos in the array by storing unique elements in a map.
```

pls help.

This case:-

1

<<<<><<<

(1<2<3<4<5>4<5<6<7)

The logic behind correct answer is:

1<2<3<4<5>1<2<3<4.

(Just count maximum consecutive occurrences of ‘<’ or ‘>’ ignoring all '='and add one to it, that will be the final answer, because in any case the maximum number of numbers required will never go above that.)

2 Likes

Actually, I too was bothered by this problem. The problem seems to be a blindspot or oversight during the understanding of the instructions. It got some relation with the evaluation of the logic of ‘>’. To give an example:

<<<<>><<<<<

Here, if you apply your function, you will get:

1<2<3<4<5>4>3<4>5>6>7<8

But in reality, based on minimizing the upper limit, it should be:

1<2<3<4<5>4>1<2>3>4>5<6 or 1<2<3<4<5>2>1<2>3>4>5<6

both of which gives 6 as the maximum of P. Another special case would be:

<>>>><<><<<<>

Which gives:

4<5>4>3>2>1<2<3>2<3<4<5<6>5

that should be:

4<5>4>3>2>1<2<3>1<2<3<4<5>4

Hope this helps.

1 Like
//