Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding
Ninjas X Naukri.com

Problem of the day

For a given array with N elements, you need to find the length of the longest subsequence from the array such that all the elements of the subsequence are sorted in strictly increasing order.

Strictly Increasing Sequence is when each term in the sequence is larger than the preceding term.

```
[1, 2, 3, 4] is a strictly increasing array, while [2, 1, 4, 3] is not.
```

Detailed explanation

```
6
5 4 11 1 16 8
```

```
3
```

```
Length of longest subsequence is 3 i.e. [5, 11, 16] or [4, 11, 16].
```

```
3
1 2 2
```

```
2
```