how dp[i]=mean(dp[j])+1,j<i and a[j]<a[i]… condition is working .
Longest increasing subsequence 1
6:36 is the time stamp
@Abhishmu5 maanlo tum index i par ho to j 0 se i-1 iterate karke dekho kahan a[j]<a[i] milega aur jahan jahan milega ans update karte rahenge 1+dp[j] aur sabse man lenge
Smjh nahin aaya bhaiya🤔
@Abhishmu5
are maanlo array hai 1 3 2
dp[1]=1 fix kardo
ab i=2 a[i]=3 toh ab peeche dekhenge kahan 3 se kam value hai coz increasing chahiye
so 1<3 toh dp[2]=max(1+dp[1],dp[2]) toh dp[2]=2
ab i=3 a[i]=2 ab peeche dekho kaun badha milega toh 1<2 so dp[2]=2 banjaayega
phir dp pe iterate karke maximuum lelo ans
bhaia just tell me about DP array here and A(array) because i am confuses here . or j kiska i kika j ki kya value and i ki kya value.
@Abhishmu5 i is running from 1 to n-1 and j running from 0 to i-1
just dry run for a small example you will understand
i is for a and j is for dp array?
@Abhishmu5 no dont think of them as separate
dp array is just storing the answers for each index
so you can say that i is for dp and j is for array a
bhaia may i call you
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.