Pls send code for this

i get the logic but i have a example proving this approach wrong
1 2 5 9 10 11 6 12

bhaiya approach would give 1 2 5 6 as longest increasing subsequence where the ans should be 1 2 5 9 10 11 12

Please send your code in a CB ide. We will try to debug that.

i haven’t coded it but i have dry run prateek bhaiya code

what he has done dp[length]< a[i] < dp[length+1]

so acc to that it would give 1 2 5 6 not 1 2 3 9 10 11

Try and code it first. Then we will see.

https://ide.codingblocks.com/s/576986. here is my code it is giving 1 2 5 6 10 12 ,but it should give 1 2 5 9 10 11 12

1 2 5 6 10 11 12* it should be output

I think you did not understand the approach to solving this question.
Please refer to this link: https://www.geeksforgeeks.org/longest-increasing-subsequence-dp-3/

the code u send is correct but i have copied prateek bhaiya code only (lis -3,4 second code for lis). but it is giving wrong ans that what i am asking

Code is not provided in the video. You must be making some mistake while coding the approach. No worries. You can refer to the approach mentioned in the link I sent. Both have a complexity of O(n) only.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.