@@shaswataraha7124 you are right maximum length of lis ending till 6 will be 3 Example 1,2,6 But not a problem small mistake although intitution is very good😁
On point explanation!! One small correction for explanation part: LIS of value 6 is 3 with count 4 {(1,5,6),(1,4,6),(1,3,6),(1,2,6)} and LIS of value 7 is 4 with count 4 {(1,5,6,7),(1,4,6,7),(1,3,6,7),(1,2,6,7)}. Keep posting more such videos ❤️
Thank you so much for this series. There was a time when I was scared just listening to the name of dp but thanks to you now it is now the most interesting topic for me. You developed the confidence in me to tackle dp problems. Thank you so much Striver!!
Bro got super excited and made a mistake during explanation :) This is the first video of the series which i have to watch twice to understand :) . BTW thanks for all the lectures.
Maybe you don't realise what you just did. YOU SAVED MY LIFE! Due to the mistakes striver made in the first example of this video, I was going to commit suicide. I had the chair, rope and fan ready. But then I came across your comment, did a dry run of the test case, and I was enlightened. Thanks a lot, keep saving lives!
There is only one mistake in the video and which hampers the complete understanding of this question !!! Will refer some other video, Thanks for the content
Hi, thanks for helping each of us and sharing your valuable knowledge. Can you also make some short videos that will be helpful for revision of basic concepts, common problems, applying DP/DSA in daily life to relate problems?
Striver, shouldn't the length of LIS till 6 should be 3, since {1 , 5 , 6} , {1 , 4 , 6} , {1 , 3 , 6} and so many other subsequences can be added. You have written 2 in the dp array. Please tell if I am thinking correct.......
currently i am on 12:50 but not getting the intution till yet , i think what bhaiya is doing may be wrong but kuch itna samajh aya ki count for any value will be that na ki use chote bande dhoodho , unme se jiska maxTillYetLIS jitni baar occur karega wahi unka count hojayega , i mean for value 6 , the maxTillYetLis occured 4 times so Lis for 6 will be 3 but count will be 4 , kyuki abhi tak jo maximum lis chalta ara hai unme hi toh naya number add karenge honge unme hi toh add karoge. similarly , ab 7 ke liye maxTillYetLIS sirf 6 pe occur kiya and count for 6 is 4 only toh in charo me 7 jodd denge. now suppose kisi value ke liye maxTillYetLIS do baar occur kara hai aur dono pe hi unka count 4 aur 4 pada hai i mean ki array lelo {.............., 8 , 7 , 9} inse peeche 8 , 7 , 9 se chote numbers hai 8 ko include karke lis kuch banra hai aur count bhi kuch banra hai similiar 7 ko include karke lis kuch banra hai aur count kuch banra hai toh 9 pe kitne banege ? , offcourse count of 7 + count of 8 na kyuki tum 7 tak ke maximum ke aage 9 jod sakte ho aur 8 tak ke maximum aage 9 jod sakte ho aur koi option do dikhta ni , toh simple count m dono ka add kardo.
If u come from a CP background then is very habitual to understand the intitution very easily.Otherwise it is very difficult to understand it at a very first time.
A small correction, LIS till 6 will be length 2 with count 4, and not 5.
How many more video are there in these playlist??
Why not lis till 6 will be length 2 I think it will be of length 3 and its count should be 4
@@shaswataraha7124 you are right maximum length of lis ending till 6 will be 3
Example 1,2,6
But not a problem small mistake although intitution is very good😁
@@pranav9653 till DP-60
Thank you for the correction..i had a doubt regarding that stuff...
On point explanation!!
One small correction for explanation part: LIS of value 6 is 3 with count 4 {(1,5,6),(1,4,6),(1,3,6),(1,2,6)} and LIS of value 7 is 4 with count 4 {(1,5,6,7),(1,4,6,7),(1,3,6,7),(1,2,6,7)}.
Keep posting more such videos ❤️
Thank you :)
Yes Prasad, but very nicely explained @TakeUForward. Kudos.
Please pin this comment!! I wasted what is going wrong for 1hour
pin this comment so that every one can see it
:)
@@takeUforward bro could you please add a note during that calculation, so we don't get confused.
Thank you so much for this series. There was a time when I was scared just listening to the name of dp but thanks to you now it is now the most interesting topic for me. You developed the confidence in me to tackle dp problems. Thank you so much Striver!!
If you want to verify, this is how the solution should look:
array: 1 5 4 3 2 6 7 10 8 9
length: 1 2 2 2 2 3 4 5 5 6
count: 1 1 1 1 1 4 4 4 4 4
++
Wrong count array should be : 1 1 1 1 1 4 4 4 8 8
@@pk4288 you've clearly made a mistake
@@pk4288 no
@@pk4288 no , he wrote the Right count array .
TIP: skip the dry run of first example to save yourself from confusion for the next hour :) . Directly jump to example 2's dry run
example 2's dry run is also wrong
@@khushalkumawat2254 not wrong
thanks for saving my time
I wan unable to understand this problem without this lecture. Thank you for this lecture.
Bhaiya ek video bana do ki how to take a good random example for dry run while explaining my code in an interview
Use your 🧠
Completed LIS..on to the next ones....Thank you for this amazing series
thanku striver ......finally ye bhi complete kr liya .....very close to finish this extra ordinary dp series .....thnaku thanku thanku striver
Understood, Thank You striver, now I am very comfortable in the LIS patter. Thank you very much.
I understood the complete series. And I am confident about the LIS questions. Thank you for the explanations and the videos.
Understood LIS Type from DP series. Thanks a lot Striver for making this series.
UNDERSTOOD......Thank You So Much for this wonderful video.......🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
Bro got super excited and made a mistake during explanation :) This is the first video of the series which i have to watch twice to understand :) . BTW thanks for all the lectures.
yes i bit confuse then i realised that its his fault
Understood! i am now falling in love with your teaching style💙
1, 1, 1, 2, ,2 , 2, 3, 3, 3 ans=27
simulate the testcase and you will find why cnt[ i ] += cnt[ j ] is used.
Maybe you don't realise what you just did.
YOU SAVED MY LIFE!
Due to the mistakes striver made in the first example of this video, I was going to commit suicide. I had the chair, rope and fan ready. But then I came across your comment, did a dry run of the test case, and I was enlightened.
Thanks a lot, keep saving lives!
@@parthsalat xD
UNDERSTOOD. Also a special thanks to the comment section for the help.
Dry run this : [34,-45,23,45,76,98,23,100] input, your mind will get boom FOR SURE!💥
Pretty much comfortable on LIS. Thank you.
Understood LIS Type from DP series. Thanks a lot Striver for making this series. ❤❤❤
Understood!! This playlist is very helpful.
Thankyou for amazing series Striver
Blessed to have ur channel bhaiya❤
Thanks for amazing thought process Striver
THANK you striver, Understood
12:40 dp[j] + 1 > dp[i] *correction
I think except LIS all other parts of DP were explained well. This part is a bit confusing.
same for me also
True
Striver is good only for Graphs
Thanks Feeling confident about LIS
best explanation ever!!!!
Understood Striver! Thank you so so much :)
Understood bhaiya.
There is only one mistake in the video and which hampers the complete understanding of this question !!! Will refer some other video, Thanks for the content
True
Understood sir , hats off
Subscribed, u are really great, the reteriving focus from us is the best, best and clear explaination that I ever seen
Did it on my own, Understood and thanks :)
Understood!!!
Thank You!!
Bro teaching wrongly but confidently 💪
😂
Jokes aside he corrected it later
Very well explained
Understood , solved without watching the video you are the besttttttttttt
i have understood this series thank you striver
Thanks striver for this amazing series and also for this question as threre are less variation of lis available on youtube
Kudos
Understood ❤
Python Solution:
def solution(nums, n):
dp, count = [1] * n, [1] * n
ml = 1
for i in range(n):
for prev in range(i):
if nums[prev] < nums[i]:
if dp[prev] + 1 > dp[i]:
dp[i] = dp[prev] + 1
count[i] = count[prev] # inherit
elif dp[prev] + 1 == dp[i]:
count[i] += count[prev] # increase the combination count
ml = max(ml, dp[i])
ans = 0
for i,l in enumerate(dp):
if l == ml:
ans += count[i]
return ans
Thank you so much for this series.
understood bhai ... u teaches absolutly well sir
Heavenly explanation!!!
Understood Thank You Striver❤
Understood very well😊😊
understood LIS pattern🤩
bhai ne ek hi jacket mein puri series bna di
understood ❤
Thanks Striver
understood
u made LIS so easy😎
Understood, sir. Thank you very much.
Sir, The LIS ending at 6 should be of length 3 and not 2
Yes that part is confusing me every time
Hi, thanks for helping each of us and sharing your valuable knowledge.
Can you also make some short videos that will be helpful for revision of basic concepts, common problems, applying DP/DSA in daily life to relate problems?
amazing
series
if u have watch his graph series where we need to calculate the no of ways . you can understand how he uses
Striver, shouldn't the length of LIS till 6 should be 3, since {1 , 5 , 6} , {1 , 4 , 6} , {1 , 3 , 6} and so many other subsequences can be added. You have written 2 in the dp array. Please tell if I am thinking correct.......
Yes you are. He did that by mistake.
Yoooo Great videso :0
Understood 😊😊😊😊
Thank you sir for making this type of question so easy👏👏
Understood 👍
Great explanation 🔥
Thank you !! :)
Yes I can✌
Understood
Plz explain Binary search O(nlogn) approach for this problem.
Unearthly explanation 🔥🔥
Understood
💯💯
Nicely explained bro ❤
Thanks Bhaiya!!!!
I understood👍
Understood, very comfortable
understood
understood sir
As always understood . Great explanation sir. Thank you
Nice series
understood,great explanation
Well understood Sir
currently i am on 12:50 but not getting the intution till yet , i think what bhaiya is doing may be wrong but kuch itna samajh aya ki count for any value will be that na ki use chote bande dhoodho , unme se jiska maxTillYetLIS jitni baar occur karega wahi unka count hojayega , i mean for value 6 , the maxTillYetLis occured 4 times so Lis for 6 will be 3 but count will be 4 , kyuki abhi tak jo maximum lis chalta ara hai unme hi toh naya number add karenge honge unme hi toh add karoge. similarly , ab 7 ke liye maxTillYetLIS sirf 6 pe occur kiya and count for 6 is 4 only toh in charo me 7 jodd denge. now suppose kisi value ke liye maxTillYetLIS do baar occur kara hai aur dono pe hi unka count 4 aur 4 pada hai i mean ki array lelo {.............., 8 , 7 , 9} inse peeche 8 , 7 , 9 se chote numbers hai 8 ko include karke lis kuch banra hai aur count bhi kuch banra hai similiar 7 ko include karke lis kuch banra hai aur count kuch banra hai toh 9 pe kitne banege ? , offcourse count of 7 + count of 8 na kyuki tum 7 tak ke maximum ke aage 9 jod sakte ho aur 8 tak ke maximum aage 9 jod sakte ho aur koi option do dikhta ni , toh simple count m dono ka add kardo.
understood the all LIS varients.
Great lecture striver. As always "Understood"
Thank you, understood.
Understood sir 🙏🙏
Understood Sir
US, understood, thanks man,.
Video is getting blurred in between.,, anyone else ?
what an energy sir loving the series
If u come from a CP background then is very habitual to understand the intitution very easily.Otherwise it is very difficult to understand it at a very first time.
loved this
Amazing videos, step by step approaches
Amazing video, well understood
UNDERSTOOD
Understood sir, thnak u soo much sir
Confident in solving LIS now
Understood Sir!
Everything looks fine! What I am wondering is how I can get this intuition on the go?
understood!
understood bro