Number of Longest Increasing Subsequence | Using LIS | Full Dry Run | META | Leetcode-673

  Рет қаралды 5,993

codestorywithMIK

codestorywithMIK

Күн бұрын

Пікірлер: 81
@codestorywithMIK
@codestorywithMIK Жыл бұрын
I will soon upload LIS and LIS all variations in my DP concepts playlist ❤
@thekindspill
@thekindspill Жыл бұрын
Awesome. Thanks a lot bhai
@ujjawalraj6096
@ujjawalraj6096 Жыл бұрын
Yes it is much needed do ASAP
@sauravbiswajit8091
@sauravbiswajit8091 Жыл бұрын
Yup .. waiting for that eagerly and plus dp using hashing and dp with bitmasking and partition dp variations also....in upcoming videos...😊😊
@sauravbiswajit8091
@sauravbiswajit8091 Жыл бұрын
Koi Aisa kuch jald bazzi nahin chahiye ...Aram se jayenge lamba jayenge..best KZbin channel banayenge 😊
@codestorywithMIK
@codestorywithMIK Жыл бұрын
@sauravbiswajit8091 It means a lot Saurav 😇❤️❤️❤️
@adityasoni5303
@adityasoni5303 Жыл бұрын
the way u explain any concept is just amazing..........keep it up......and thanku very much
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Thank you so much Aditya 😇❤️🙏
@dayashankarlakhotia4943
@dayashankarlakhotia4943 Жыл бұрын
Understood. Please make full series on LIS AND LCS
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Yessss. The next video on DP Concepts and Qns will be on LIS and all it’s variants will be covered
@vivekkumaryadav9862
@vivekkumaryadav9862 Жыл бұрын
thanks sir..bht badiya or simple way se explain kiye aap.
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Thank you 😇🙏
@rohithboppey3205
@rohithboppey3205 Жыл бұрын
Hey MIK! Been a subscriber for so long, and here is my first comment. I have done my dry run and understood the algorithm, but can you give a example where the count array is being updated multiple times, I will dry run it for better understanding. Thanks a lot MIK for uploading videos regarding Leetcode POTD daily! Huge love. 💖
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Hi Rohit, thank you so much for all the love and respect you guys have given me. Please try a dry run with this one also - [1,3,5,4,7,2,3,4,2,3,4,5] Might be lengthy, but it helps.
@rohithboppey3205
@rohithboppey3205 Жыл бұрын
@@codestorywithMIK sure sir. Will do it and keep a GitHub gist link for my fellow viewers. Thank you for replying sir.
@ishwarkokkili7646
@ishwarkokkili7646 Жыл бұрын
Please make LIS - recursion + memo, Bottom up dp and all the LIS pattern questions in dp concept and questions
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Yes yes already planned . I have all the list. One by one i will post in dp concepts playlist
@wearevacationuncoverers
@wearevacationuncoverers Жыл бұрын
++
@kishan.17
@kishan.17 Жыл бұрын
Super explanation bro ❤ always yours stories are great to understand ans learn bro
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Thank you so much Kishan 😇❤️ Glad it was clear. Also recursion memo version will be uploaded in DP concepts playlists soon
@anuppatankar4294
@anuppatankar4294 Жыл бұрын
Crystal Clear Explanation 👌🏻
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Thanks a lot Anup 😇❤️
@sauravbiswajit8091
@sauravbiswajit8091 Жыл бұрын
As usual great ji 😊😊
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Thank you so much Saurav ❤😃
@RAUSHANKUMAR-gw9ri
@RAUSHANKUMAR-gw9ri Жыл бұрын
Your explanations is really good.🎉
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Thanks a lot Raushan ❤️
@user-jp9jd6el1f
@user-jp9jd6el1f 9 ай бұрын
bro so detailed and well explained All the best bro Now u get new Subscriber
@codestorywithMIK
@codestorywithMIK 9 ай бұрын
Thank you and welcome to my channel ❤️
@AstroboyHimanshu
@AstroboyHimanshu Жыл бұрын
This video is Pure Gold ❤❤✨✨🙏🙏
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Means a lot. Thank you so much ❤️❤️❤️
@codeandtalk6
@codeandtalk6 Жыл бұрын
I solved it own ❤❤❤ thank you bro
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Wowww Awesome 😇👍🏻
@user13443fg
@user13443fg 7 ай бұрын
why (dp[j]+1>dp[i]) this condition in "else if" block ?? why cant simply write else?
@AryanTomar_2025
@AryanTomar_2025 Жыл бұрын
Sir please iska recursive + memo solution bhi explain kardo
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Yes yes, coming in DP concepts playlist
@jeelanibasha3984
@jeelanibasha3984 2 ай бұрын
I have a doubt if we have an example with arr of 1,3,2 according to the code we would get max cnt as 1 but can't it be 2 as (1,3)(1,2)
@tauquirahmed1879
@tauquirahmed1879 Жыл бұрын
The level of concentration that I give when bhaiya say "Ab dhyan dena ab maza ayega" is unmatchable. 🥰
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Ah, you just made my day. Thank you so much Tauquir ❤️❤️ I hope today’s video was worth learning
@tauquirahmed1879
@tauquirahmed1879 Жыл бұрын
@@codestorywithMIK haan bhaiya... 💞💯
@wearevacationuncoverers
@wearevacationuncoverers Жыл бұрын
Lol. exactly 😅
@souravjoshi2293
@souravjoshi2293 Жыл бұрын
ha ha. sahi me bhai
@thekindspill
@thekindspill Жыл бұрын
true
@deepakagrawal7687
@deepakagrawal7687 2 күн бұрын
I have seen this problem solving by other youtubers as well but one query is still present, why for 1,3,5,4 in count array value is 1? Definition of count array is total LIS ending at ith index. so if we take example of 1,3,5,4 then LIS is 3 ((1,3,5), (1,3,4)) but in count array the value you have shown is {1, 1, 1, 1} which means there is only 1 count of LIS with 3 but in reality there are 2 LIS. Am I missing something?
@Rajdweep
@Rajdweep Жыл бұрын
great explanation bro,i was trying to find the count in recursive way using prev and index in function,bt im unable to do so...is there a way to find the count while going top down in LIS?
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Yes i will post that in DP concepts playlist Thanks a lot 😇🙏❤️
@Rajdweep
@Rajdweep Жыл бұрын
@@codestorywithMIK okk cool
@AyushRaj-we2og
@AyushRaj-we2og Жыл бұрын
Understood😇😇
@AlishaKhan-ww3io
@AlishaKhan-ww3io Жыл бұрын
You are a legend
@UtkarshPatel-v9o
@UtkarshPatel-v9o Жыл бұрын
maja aa gaya
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Thank you so much for watching 😇❤️
@abc-ym4zs
@abc-ym4zs Жыл бұрын
bhaiya if possible can u tell me what are the patterns u are going to discuss in your dp series up to now how many patterns u discussed in future which pattern u will discuss bhaiya
@codestorywithMIK
@codestorywithMIK Жыл бұрын
1.Linear DP 2.Knapsack 3.Multi Dimensions DP 4.Interval DP 5.bit DP 6.String DP 7. Variants of LIS, LCS, Cadane's, 8. DP on Trees 9. MCM and it's variants More might come as time comes. Hope this help 😃
@053_tanweer7
@053_tanweer7 Жыл бұрын
Hey mik! Can you solve this with recursion + memo?
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Hi there 🙂 yes yes, I will upload it in DP concepts and Qns playlist where I will first teach LIS, then all it's variants
@053_tanweer7
@053_tanweer7 Жыл бұрын
@@codestorywithMIK I have coded it but not able to memoize it?
@053_tanweer7
@053_tanweer7 Жыл бұрын
@@codestorywithMIK this is giving TLE... PLZ MEMOIZE IT class Solution { public: int n; mapm; vectorv; void solve(int idx, vector& dp, vector &nums){ if(idx nums[idx]){ // take v.push_back(nums[idx]); solve(idx-1,dp,nums); v.pop_back(); // not take solve(idx-1,dp,nums); } else solve(idx-1,dp,nums); } int findNumberOfLIS(vector& nums) { n= nums.size(); v.push_back(1e9); vector dp(n,-1); solve(n-1,dp,nums); for(auto it:m){ cout
@kartikforwork
@kartikforwork 8 ай бұрын
hey i found the code of piority sort or lasy sort you taught in lis for this, but its a difficult to understand can you make a video explaining using this method. will wait for it. ty in adv here is the code- class Solution { public: int findNumberOfLIS(vector& nums) { vector piles; piles.push_back({{nums[0], 1}}); for (int i = 1; i < nums.size(); ++i) { int num = nums[i]; int idx = 0; for (; idx < piles.size(); ++idx) { if (piles[idx].back().first >= num) break; } int lis_count = 0; if (idx > 0) { for (int j = piles[idx - 1].size() - 1; j >= 0; --j) { if (piles[idx - 1][j].first >= num) break; lis_count += piles[idx - 1][j].second; } } else { lis_count = 1; } if (idx == piles.size()) { piles.push_back({{num, lis_count}}); } else { piles[idx].push_back({num, lis_count}); } } int result = 0; for (auto& pair : piles.back()) { result += pair.second; } return result; } };
@s.s.shetty6548
@s.s.shetty6548 Жыл бұрын
what will be the time complexity for this?
@codestorywithMIK
@codestorywithMIK Жыл бұрын
It’s O(n^2) because for every i, we traverse j from 0 to i-1 resulting in nested for loop
@rajkrishanmahajan2373
@rajkrishanmahajan2373 Жыл бұрын
can little bit explain what is LIS AND LCS ? 😅
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Sure 😇 LIS - Longest Increasing Subsequence LCS - Longest Common Subsequence Do not worry, all these and their variants will be covered in my DP concepts playlist
@amitkumarchoudhary9008
@amitkumarchoudhary9008 Жыл бұрын
Bhaiya recursive mai kaise hoga without using dp
@codestorywithMIK
@codestorywithMIK Жыл бұрын
I will upload it in DP concepts and Qns playlist
@doctorajshorts1590
@doctorajshorts1590 Жыл бұрын
can you please make a video on 273. Integer to English Words on leetcode , please
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Noted on this. Let me soon plan
@floatingpoint7629
@floatingpoint7629 Жыл бұрын
not sure why my comments are not appearing
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Yes sometimes youtube does it. I am also not sure why ☹️
@yashgarg3027
@yashgarg3027 Жыл бұрын
bhaiya core subjects ka kuch bata do kase karu 1 week ma ho jae ache se as placements season has started plz help bhaiya
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Data Structures and Algorithms: Understanding data structures like arrays, linked lists, trees, graphs, and algorithms like sorting, searching, Time complexity. Database Management Systems (DBMS): Learn about database design, normalization, SQL queries, and database management concepts, ACID properties etc. Also, Learn about relational databases, normalization, and SQL queries. Operating Systems: Gain knowledge about processes, threads, memory management, file systems, and synchronization. Computer Networks: Understand the basics of networking, including protocols, IP addressing, routing, and network layers. Object-Oriented Programming (OOP): Understand OOP principles and concepts like inheritance, polymorphism, and encapsulation. This is a rough idea on what major things should be focused in short span of time.
@yashgarg3027
@yashgarg3027 Жыл бұрын
@@codestorywithMIK bhaiya jitne ye aapne topics btae hain corr subjects k more than sufficient hain na ??
@Slow_learner33
@Slow_learner33 Жыл бұрын
@@yashgarg3027 yes bro , exactly because very less companies ask system design you can skip it if u have less time
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Yes
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Freshers are not asked much on System design . Since you are a fresher, strengthen the important topics first only.
@abhishekjha3499
@abhishekjha3499 10 ай бұрын
bro i am a student and would like to take your opinion on one thing as you can see aaj kal sab ne 500 plus question krrkhe he leetcode pe and then so it is possible ki un 500 questions pe unhone kai sheets bb solve krii hogi famous sheets jisko lekar log gurantee dete he ki use solve krne se job hojyegi and i also think that wo sheets ke question achee he and u need lot of practice to solve them and its not everybody cup of tea , to bhai aapko bb lagta he ye jo post krte he mostly linkedin pe its fake ??kuki mene bb kaii interviews dekhe he and mostly inhi me se pchte he and max to max system design ya aapke projects me se what do you think??
@thedarkknight1865
@thedarkknight1865 Жыл бұрын
Memo DP || Java class Solution { private record Pair(int length, int count) {} private int n; private Pair[][] dp; public int findNumberOfLIS(int[] nums) { n = nums.length; dp = new Pair[n][n+1]; return solve(0, -1, nums).count(); } private Pair solve(int idx, int prev, int[] nums) { if(idx == n) return new Pair(0, 1); if(dp[idx][prev + 1] != null) return dp[idx][prev + 1]; Pair notPick = solve(idx + 1, prev, nums); int notPickLen = notPick.length(); int notPickCount = notPick.count(); int pickLen = 0; int pickCount = 0; if(prev == -1 || nums[idx] > nums[prev]) { Pair pick = solve(idx + 1, idx, nums); pickLen = pick.length() + 1; pickCount = pick.count(); } Pair res = null; if(pickLen == notPickLen) { res = new Pair(pickLen, pickCount + notPickCount); } else if(pickLen > notPickLen) { res = new Pair(pickLen, pickCount); } else { res = new Pair(notPickLen, notPickCount); } return dp[idx][prev + 1] = res; } }
@codestorywithMIK
@codestorywithMIK Жыл бұрын
And here it is ❤️🔥 Thanks a lot for sharing
@wearevacationuncoverers
@wearevacationuncoverers Жыл бұрын
Thanks for sharing this bro @codestorywithMIK are you planning to cover recursive version as well in your concepts playlist ?
@AryanTomar_2025
@AryanTomar_2025 Жыл бұрын
Bro can you explain that how count is updating
If people acted like cats 🙀😹 LeoNata family #shorts
00:22
LeoNata Family
Рет қаралды 23 МЛН
Smart Sigma Kid #funny #sigma
00:33
CRAZY GREAPA
Рет қаралды 8 МЛН
Чистка воды совком от денег
00:32
FD Vasya
Рет қаралды 2,7 МЛН
DP 47. Number of Longest Increasing Subsequences
20:46
take U forward
Рет қаралды 118 М.
DP 43. Longest Increasing Subsequence | Binary Search | Intuition
16:27
How I Mastered Data Structures and Algorithms in 8 Weeks
15:46
Aman Manazir
Рет қаралды 103 М.
NVIDIA’s New AI: Stunning Voice Generator!
6:21
Two Minute Papers
Рет қаралды 79 М.
How I Approach a New Leetcode Problem (live problem solving)
25:31