Smallest Range Covering Elements from K Lists | Multiple Ways | Leetcode 632 | codestorywithMIK

  Рет қаралды 9,047

codestorywithMIK

codestorywithMIK

Күн бұрын

Пікірлер: 78
@aws_handles
@aws_handles Ай бұрын
Others posting 10-15 minutes video on this problem. Here is the LEGEND MIK with 50 minutes video with Brute Force, Better and optimal 🔥🔥🔥🔥
@dchennaraidu
@dchennaraidu Ай бұрын
LOL! He's the best
@harchitgulati3065
@harchitgulati3065 Ай бұрын
bro time of video se matter ni karta MIK is Legend agreed but jha se jisko smjh aa rha best for them
@EB-ot8uu
@EB-ot8uu Ай бұрын
Feeling bad for those who will skip this video because of length. This is nothing but pure gold. This legend actually teaches how our thought process should work during solving such problems. Thanks a lot
@froglighthouse1223
@froglighthouse1223 Ай бұрын
instead of watching 15 min videos 5 times and still not understanding clearly, it is better to watch this 50 minute video and get all concepts fixated into your mind forever
@codestorywithMIK
@codestorywithMIK Ай бұрын
♥️♥️🙏🙏
@shreyanshgupta6465
@shreyanshgupta6465 Ай бұрын
This is the naive approach that I wrote and it passed 89/90 test cases with the time complexity of O(n^3). Thanks, bro your explanation really gives a natural feeling (like koi bhaiya apne bhai ko sikha rhe ho)
@harshchhallani2268
@harshchhallani2268 Ай бұрын
I never comment, but you deserve one for taking me from the most native to the optimal , and you made me think of the solution unlike others just telling this is the way to do it. You develop our brains to think like you think when you tackle a problem.
@tharunkumar8133
@tharunkumar8133 Ай бұрын
Those who are not watching the video because of the duration are missing out on so much good stuff.. Keep it up Mr. MIK!!
@EB-ot8uu
@EB-ot8uu Ай бұрын
true bhai
@kushjoshi9427
@kushjoshi9427 Ай бұрын
i have done a similar question on leetcode called merge k sorted linked list the concept is same for the using the heap. That time I didn't grasp the concept fully thanks to you now i know it better.
@amanpaliwalvlogs6860
@amanpaliwalvlogs6860 Ай бұрын
Bhai..... salute you ❤❤❤
@jeehub041
@jeehub041 Ай бұрын
Proper Proper explanation bhaiya pura brute se optimal tak sab chamak gaya🙌🙌
@diskritis2076
@diskritis2076 Ай бұрын
its funny that i was not able to solve the problem originally but when i listened to his brute force solution, i just solved the problem on my own lol.
@chic_koo
@chic_koo Ай бұрын
Wow 😲, the way you started with simplest thought process ❤ and go step by step maza hi aa gya yrr bhaiya , amazing. Your dedication and hard work toward teaching us how to approach solution , rally you make us think the solution itslef. Greatttttt yrr
@nehasinghggpl9637
@nehasinghggpl9637 Ай бұрын
you are awesome aapke bade video bhi darate nhi hai, aaram se dekh leti hu..
@souravjoshi2293
@souravjoshi2293 Ай бұрын
Few of the words I call MIK with now : 1. Legend 2. Goat 3. DSAGOD If you doubt it, watch his videos and thank me later
@mohammadaftabansari6882
@mohammadaftabansari6882 Ай бұрын
Thanks for the awesome detailed explanation, Yoyr videos are a great help in my DSA journey.
@basu8870
@basu8870 Ай бұрын
God level explanation 🔥🔥🔥🔥🔥
@SunshineWisdom-h2p
@SunshineWisdom-h2p Ай бұрын
Thank you, Bhaiya for explaining everything in detail .
@skmdjeesan_
@skmdjeesan_ Ай бұрын
you are legend sir!
@codingedtech
@codingedtech Ай бұрын
super....... explained 😮
@bokthair4605
@bokthair4605 Ай бұрын
00:03 Introduction to Leetcode problem 632 with multiple ways 00:54 Smallest Range Covering Elements from K Lists 02:34 Understanding the concept of smallest range covering elements in K lists. 03:18 Finding the smallest range covering elements from K lists 04:57 Creating ranges in a list based on given conditions 05:42 Finding the smallest range covering elements from K lists 07:17 Finding the smallest range covering elements from multiple lists 08:05 Finding the range between numbers in the list. 09:33 Finding valid pairs and tracking minimum range 10:17 Understanding the importance of sorted input in algorithms. 11:44 Find the smallest range covering given numbers 12:33 Selecting smallest range covering elements from K lists 14:07 Understanding and accessing elements using pointers in lists 14:54 Finding the minimum and maximum elements to create a range. 16:21 Understanding how to minimize range in a list of elements. 17:06 Avoid altering the maximum element in the range while minimizing the range size. 18:31 Updating minimum and maximum elements in a list 19:17 Finding the smallest range 20:47 Finding the smallest range covering elements from K lists 21:24 Efficiently find the smallest range covering elements from K lists. 22:54 Calculating the smallest range from elements in K lists 23:39 Finding the smallest range from K lists 25:06 Break the loop, find smallest range from K lists 25:49 Solving minimum and maximum range covering elements with constraints 27:25 Remember indexes of each list at starting 28:07 Finding the minimum element and its index in a list 29:43 Identifying the minimum element's index is crucial 30:24 Continuously update and maintain the range for out of bound list 31:49 Explaining smallest range covering elements from K lists 32:42 Find the minimum and maximum value from each list 34:35 Understanding range calculation in a list of elements 35:40 Updating the range if minimum element is changed 37:39 Implement a solution to find the smallest range covering elements from K lists. 38:59 Understanding the optimal approach for heap in detail. 40:33 Understanding element identification and tracking in lists 41:37 Min heap can be used to find the smallest range covering elements from K lists 43:06 Checking for minimum element indices 43:55 Understanding index and priority in pushing elements 45:30 Understanding the importance of values and indices 46:15 Using min heap and storing elements and their indices. 47:48 Understanding the process of finding the smallest range covering elements from K lists. 48:42 Explanation of finding the maximum of elements 50:33 Explaining how to handle minimum range 51:30 Algorithm to find the smallest range covering elements from K lists
@dayashankarlakhotia4943
@dayashankarlakhotia4943 Ай бұрын
leetcode weekly contest qn.no.4 is so good I have solve qn no.3 dp for inspiring your dp playlist🎉❤
@anuragprajapati3712
@anuragprajapati3712 Ай бұрын
nice explanation , very much informative!!
@akashnaik5567
@akashnaik5567 Ай бұрын
Legend Mike bhai ❤
@quantum_engineering
@quantum_engineering Ай бұрын
crazy explanation ❤❤
@thaman701
@thaman701 Ай бұрын
Wow sir what an explanation 🎉❤
@mdfarhan5364
@mdfarhan5364 Ай бұрын
Can you also provide explanation of good contest problems like tomorrow last 2 questions
@AryanVats603
@AryanVats603 Ай бұрын
Was waiting for it!!!
@YashSinghal
@YashSinghal Ай бұрын
Amazing. But very very hard to think of this approach during an interview.
@Coder_Buzz07
@Coder_Buzz07 Ай бұрын
Motivation❤❤❤❤
@jeehub041
@jeehub041 Ай бұрын
Ist view as always but bhaiya please Leetcode Contest ke questions pe bhi ek video per day laaiye because koi acha explanation available hi nahi ha. Please bhaiya only 2 videos every day Will make a huge difference in our lifes ❤❤
@wearevacationuncoverers
@wearevacationuncoverers Ай бұрын
Jitna thanks bolu kam hai. Sir aapse milna hai and thank you bolna hai saamne se.
@YashJain-ex2ex
@YashJain-ex2ex Ай бұрын
I was thinking using with the binary search as there is a mention of range, and binary search deals with range also, for the given test case if we consider to get the smallest and the largest it would be [0, 30], now our and lies between 0 and 30, binary search to find mid = 0+30 = 15 find the = in another (or directly store the range )element from each list and select the range which is shortes, and then perform again, if the answer does not change that is the answer will it work?
@abhinay.k
@abhinay.k Ай бұрын
thanks
@vivekyadav-tharoara
@vivekyadav-tharoara Ай бұрын
I tried by myself ( 5hr😢 ) i am able to pass 89/90 and last one gave me Time limit exceed.
@vickyroy3595
@vickyroy3595 Ай бұрын
MIK , do video on weekly contest
@gui-codes
@gui-codes Ай бұрын
third ❤ Wait is Over.
@aizad786iqbal
@aizad786iqbal Ай бұрын
a < c if b - a == d - c. why this case u didn't cover in method 1 , will it never occur ?
@ShresthBhattacharjee-xz7ih
@ShresthBhattacharjee-xz7ih Ай бұрын
I tried it using binary search passed 67/90 testcases was waiting for video for the solution. Thank you for your hard work for us❤.
@ArnabBhadra02
@ArnabBhadra02 Ай бұрын
While(!pq.enpty( ) ke badle while (true ) bhi to de sakte the na? Kiuki break to hogahi hoga
@Siddharthsirsate77
@Siddharthsirsate77 Ай бұрын
Which writing notes application do you use?
@nikhilvasu478
@nikhilvasu478 Ай бұрын
idk why, i got TLE with first method, optimized bruteforce
@monugit9
@monugit9 Ай бұрын
@ManojKrVerma-vw4dx
@ManojKrVerma-vw4dx Ай бұрын
I could solve this on my own. So it feels like it should not have been a hard tagged problem. BTW I enjoyed solving it. @MIK bhaiya what are your thoughts on it ?
@codestorywithMIK
@codestorywithMIK Ай бұрын
That’s great that you solved on your own. It was a very good Qn
@khushvantkumar1670
@khushvantkumar1670 Ай бұрын
Contest ka video bnao bhai
@rajeshkumar-ws5ku
@rajeshkumar-ws5ku Ай бұрын
bhaiya what i do ,i can't able to solve leetcode contest questions despite giving our 100 percent ,i have solve around 300 questions on leetcode ,despite that i am not able to solve the question.Please give me some suggestions bhiya it helps me alot.
@Engineeringlife651
@Engineeringlife651 Ай бұрын
Us bro us
@RajeshKumar-xe7mk
@RajeshKumar-xe7mk Ай бұрын
What do u mean ​@@Engineeringlife651
@shreyanshjain1595
@shreyanshjain1595 Ай бұрын
WHAT IF THERE ARE TWO MINIMUM NUMBERS,THEN WHICH POINTER WILL WE HAVE TO MOVE , HOW DO WE DECIDE THAT?
@gauravbharti7852
@gauravbharti7852 Ай бұрын
What's the key for code indentation?
@shreyanshjain1595
@shreyanshjain1595 Ай бұрын
HOW DID YOU GET THE INTUITION OF THIS SOLUTION 😭 PLEASE EXPLAIN
@WealthVibe1
@WealthVibe1 Ай бұрын
i tried brute force i got tle
@dayashankarlakhotia4943
@dayashankarlakhotia4943 Ай бұрын
First 🎉❤
@anukulsahu
@anukulsahu Ай бұрын
Bhai interview me koi kaise sochega ye approach
@RishabhChatterjee-fg2gz
@RishabhChatterjee-fg2gz Ай бұрын
Array and strings k problem mein dikkat Hota Hai, kyese improve karu, bolo bhaiya, aap reply nehi karte ho
@rode_atharva
@rode_atharva Ай бұрын
i found solution by myself in 5 minutes. just cant figure out how to handle max element.
@md.taohidimamkhantamim9747
@md.taohidimamkhantamim9747 Ай бұрын
52 minutes were as like as story.
@thekindspill
@thekindspill Ай бұрын
🫡🔥
@tvshows4721
@tvshows4721 Ай бұрын
Sir Why your contest rating is too low ?
@codestorywithMIK
@codestorywithMIK Ай бұрын
I used to give contests long before. Now i travel during weekends ♥️ But when I get time, I do solve Qn4 sometimes and post on my channel
@tvshows4721
@tvshows4721 Ай бұрын
@@codestorywithMIK ok Sir
@gauravmundhada1647
@gauravmundhada1647 Ай бұрын
How come one will able to think this solution in interview😭
@RishabhChatterjee-fg2gz
@RishabhChatterjee-fg2gz Ай бұрын
Bhaiya I am demotivated because problem is not solved by me, even brute force also, after watching I can solve it
@priyanshugupta5893
@priyanshugupta5893 Ай бұрын
bhai karte jaao bass, interview main sirf ek baar lucky hone hai. toh agar 10 doge ek lagega. and you only need one job :)
@mahalakshmi.m7994
@mahalakshmi.m7994 Ай бұрын
Mik can u please upload potd in english from tomorrow..🙏
@ch0c0_1
@ch0c0_1 Ай бұрын
I think we get more clarity in hindi than English, so i disagree
@aws_handles
@aws_handles Ай бұрын
Hindi is very helpful 😢 i understand it easily. Please keep in Hindi
@harishms5330
@harishms5330 Ай бұрын
Bro on captions
@simrannegi7608
@simrannegi7608 Ай бұрын
if i could give you thousands of likes, I definitely would!
@dhairyachauhan6622
@dhairyachauhan6622 Ай бұрын
VERY SIMPLE SOLUTION USING PRIORITY_QUEUE MINING METHOD. class Node { public: int data; int i; int j; Node(int data, int i, int j) { this->data = data; this->i = i; this->j = j; } }; struct comparator { bool operator()(Node* a, Node* b) { return a->data > b->data; } }; class Solution { public: vector smallestRange(vector& nums) { int n = nums.size(); priority_queue pq; int maxVal = INT_MIN; for (int i = 0; i < n; i++) { pq.push(new Node(nums[i][0], i, 0)); maxVal = max(maxVal, nums[i][0]); } coutj; pq.pop(); int rangeVal = maxVal - data; if (rangeVal < minRange) { minRange = rangeVal; ans[0] = data; ans[1] = maxVal; } if (j + 1 < nums[i].size()) { pq.push(new Node(nums[i][j + 1], i, j + 1)); maxVal = max(maxVal, nums[i][j + 1]); } else { break; } } return ans; } };
@AnujYadav-xr3yw
@AnujYadav-xr3yw Ай бұрын
Bro can you share your leetcode username?
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 2,1 МЛН
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 31 МЛН
If people acted like cats 🙀😹 LeoNata family #shorts
00:22
LeoNata Family
Рет қаралды 23 МЛН
Machine Learning for Everybody - Full Course
3:53:53
freeCodeCamp.org
Рет қаралды 8 МЛН
Reinforcement Learning Course - Full Machine Learning Tutorial
3:55:27
freeCodeCamp.org
Рет қаралды 913 М.
AWS Certified Cloud Practitioner Training 2020 - Full Course
3:58:01
freeCodeCamp.org
Рет қаралды 7 МЛН
C Programming Tutorial for Beginners
3:46:13
freeCodeCamp.org
Рет қаралды 14 МЛН
Complete Dynamic Programming Practice - Noob to Expert | Topic Stream 1
3:50:43
Knuth-Morris-Pratt KMP String Matching Algorithm | Search Pattern | GFG POTD
1:05:36
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 2,1 МЛН