Problem Link - https://www.codechef.com/problems/RECNDROT

Can somebody please explain why the answer to the third test case here is 2 and not 1?

Problem Link - https://www.codechef.com/problems/RECNDROT

Can somebody please explain why the answer to the third test case here is 2 and not 1?

```
5
1 3 2 1 2
```

For M=1, sequence is `1 3 2 1 2`

, hence longest increasing sub sequence has length 2: [1,2].

For M=2, sequence is `1 3 2 1 2 1 3 2 1 2`

, hence longest increasing sub sequence has length 3: [1,2,3]. This is also maximum possible length.

1 Like