Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit | Leetcode 1438 |Detailed

  Рет қаралды 10,914

codestorywithMIK

codestorywithMIK

Күн бұрын

Пікірлер: 84
@codestorywithMIK
@codestorywithMIK 4 ай бұрын
Correction - Video - 24
@Polly10189
@Polly10189 6 ай бұрын
You have a God gifted talent of intelligence and explaining it so simply. Than you so much🎉
@prathmeshkakde3731
@prathmeshkakde3731 6 ай бұрын
True ,wish I had teacher like him earlier!!!!
@ramandeepsingh8464
@ramandeepsingh8464 6 ай бұрын
Please don't stop posting video and if you have time then please do contest discussion also
@manibhushankumarsingh5196
@manibhushankumarsingh5196 6 ай бұрын
00:07 Find the longest continuous subarray with an absolute difference less than or equal to a given limit 02:12 Finding the longest continuous subarray with absolute difference less than or equal to limit. 06:23 To validate a sub-array, find the difference between its maximum and minimum elements. 08:27 Identifying valid subarrays based on difference limit. 12:38 Using a heap can efficiently track the minimum element within the window. 14:43 Implementing window sliding technique for efficient computation 18:33 Analyzing subarrays based on element limits 20:47 Algorithm for finding longest continuous subarray with absolute difference less than or equal to limit 24:13 Dry runs help in gaining clarity for solving problems. 25:59 Understanding the shifting of elements in the max and min heaps during traversal. 29:41 Finding valid subarrays with absolute difference less than limit. 31:40 Iterating through the array and checking limits for valid subarrays 35:40 Algorithm for finding longest continuous subarray with absolute difference less than or equal to limit 38:07 Discussed time complexity and approach for a sliding window problem 41:58 Efficient data structure for finding maximum and minimum elements with a given limit 43:50 Explanation of using Multi Set in C++ for efficient operations 47:20 Explanation of using max heap and multi set for inserting and removing elements.
@michaelmaahi7384
@michaelmaahi7384 6 ай бұрын
Thank you bhai
@kaustubhchaudhari9838
@kaustubhchaudhari9838 6 ай бұрын
God Gifted Mic Bhai, Thank you for Explaining so easily
@StackUnderFlow8055
@StackUnderFlow8055 6 ай бұрын
today i did the first question with a multiset , amazing explanation ❤❤
@pavittarkumarazad3259
@pavittarkumarazad3259 6 ай бұрын
Thanks, approach 2 was really amazing. I was able to solve it on my own with the 1st approach but what was more amazing was that you showed us why we need a TreeMap data structure while building the intuition.
@ShardulPrabhu
@ShardulPrabhu 6 ай бұрын
Thanks sir ❤ only question explain kr k pause krne bataya uske liye mere 😢 you care for us 😢😢 thank you so much
@anjanasahay2172
@anjanasahay2172 6 ай бұрын
Yes Please Contest problems too...the hard and medium ones❤❤
@saminaabbas9722
@saminaabbas9722 6 ай бұрын
Thank you MIK! You're the best
@manishdubey4772
@manishdubey4772 6 ай бұрын
@codestorywithMIK Hi sir, you discuss the 2nd approach which is using the TreeMap but there also arises one problem i.e if we have all unique elements then we have to traverse through all the elements of the map as I think there is no any way to get the smallest and largest element directly in O(1) time complexity. Can you please discuss it? At last, I really like your explanation of the question problem like a story, I want to thank you for your great videos
@thefinalfit
@thefinalfit 6 ай бұрын
Complete legend. Detailed each step
@floatingpoint7629
@floatingpoint7629 6 ай бұрын
thanks for the multiple dry run
@ashutoshpandey1639
@ashutoshpandey1639 6 ай бұрын
I have solved this prolem using multiset, I think multiset wala approach is more intuitive than using priority queue
@user13443fg
@user13443fg 6 ай бұрын
Nice you stopped writing topic name in video thumbnail. It is necessary to understand problem first and build Intuition. i hope you will not show topics in video thumbnail in your future videos as well :)
@gauravbanerjee2898
@gauravbanerjee2898 6 ай бұрын
Thanks a lot bhaiya ❤❤ Bohot hi pyara explanation tha 🔥
@rahulnegi4027
@rahulnegi4027 6 ай бұрын
Bhaiya pleas leetcode ke contest ke question ke solution bhi explain krdo please apki explanation boht badiya lagti h please..... waiting for the series where you will do contest problems
@gui-codes
@gui-codes 6 ай бұрын
I felt this was hard but man you explain so well.
@Lakshya-f4l
@Lakshya-f4l 6 ай бұрын
Thanks a lot sir!
@ArpitDhimaan
@ArpitDhimaan 6 ай бұрын
bro pls add time stamp in future videos. It , saves lot of time.
@23cash86
@23cash86 6 ай бұрын
Great video as always
@CodeMode9313
@CodeMode9313 6 ай бұрын
Little correction !!!! TIme stamp 9:19 , a lil minute error , diff b/w max and min is 7 not 6
@EB-ot8uu
@EB-ot8uu 6 ай бұрын
legit. thanks a lot legend
@imPriyansh77
@imPriyansh77 6 ай бұрын
Great Explanation Bhaiya!!! Thank you...
@chitranshjain9714
@chitranshjain9714 6 ай бұрын
Please resume dp concept series
@venkatarohitpotnuru38
@venkatarohitpotnuru38 6 ай бұрын
Bhaiya weekend aagya..partion dp concept videos
@AnjuGupta-sz1uk
@AnjuGupta-sz1uk 6 ай бұрын
Amazing Expalnation 😊
@arjunprasad1071
@arjunprasad1071 6 ай бұрын
Great explaination! if its possible please make an explainer on the O(N) approach ie deque approach🙏🙏
@tarunsingh2480
@tarunsingh2480 6 ай бұрын
great explanation man ...
@animestuff144
@animestuff144 6 ай бұрын
Awesome explanation sir
@anshror2583
@anshror2583 6 ай бұрын
Bhai aap please contest ki 3 and 4 problem discuss kara laro please bhai request h
@Vinamrasharma0523
@Vinamrasharma0523 6 ай бұрын
Waiting for this ❤
@DevOpskagyaan
@DevOpskagyaan 6 ай бұрын
Amazing explanation man
@surekhasonawane4045
@surekhasonawane4045 6 ай бұрын
Solved using Multiset as we can get min/max in O(1) . and deletion in O(1) whenever window's absolute difference exceed limit
@gui-codes
@gui-codes 6 ай бұрын
bhai multiset jaise STLs ko kaha se parha ? Can you share any good resource.
@jitesh_khurana
@jitesh_khurana 6 ай бұрын
@@gui-codes gfg se padhle bhai
@jitesh_khurana
@jitesh_khurana 6 ай бұрын
int longestSubarray(vector& nums, int limit) { int ans = 1; int n = nums.size(); int i = 0; int j = 0; multiset st; while(j
@study-yd6es
@study-yd6es 6 ай бұрын
Amazing Explainations!!😍
@VedBrahmbhattBEE
@VedBrahmbhattBEE 6 ай бұрын
Awesome as always.
@ashish3487
@ashish3487 6 ай бұрын
sir make some more questions video on segment tree
@chitranshjain9714
@chitranshjain9714 6 ай бұрын
amazing explanation
@SanjeevKumar-xv5lw
@SanjeevKumar-xv5lw 5 ай бұрын
Why didn't we use two deques for maintaining min and Max of the window avoiding that extra log n term which comes with heap and multiset?
@aizad786iqbal
@aizad786iqbal 6 ай бұрын
one doubt, pop should be O(1) right, as we just delete the top element.... the push is log(n) time correct ? please confirm...
@cricketsureshlucky
@cricketsureshlucky 6 ай бұрын
Thank you so much
@abhinavnarang4369
@abhinavnarang4369 6 ай бұрын
bhaiya segmenr tree ki playlist continue krdo,interview h
@prakharTiwari-c8n
@prakharTiwari-c8n 6 ай бұрын
@codestorywithMIK , Thanks for your so detailed video but how TreeMap store duplicate value ?
@anishbishnoi29xD
@anishbishnoi29xD 6 ай бұрын
i think TreeSet does not store duplicate value but TreeMap can store
@harshsingh7713
@harshsingh7713 4 ай бұрын
Guru ji Longest Nice subarray pe solution bna do please
@manpreetsaluja3691
@manpreetsaluja3691 6 ай бұрын
I do it with map and sliding window concept
@cricketsureshlucky
@cricketsureshlucky 6 ай бұрын
Sir my kind request please upload a video on today's contest 3rd question. It is quite difficult solving dp.
@ramandeepsingh8464
@ramandeepsingh8464 6 ай бұрын
Exactly 💯
@RitikRanjan-fn9me
@RitikRanjan-fn9me 6 ай бұрын
try to think something related to consecutive negative numbers and apply pick not pick conditions accordingly
@cp65143
@cp65143 6 ай бұрын
+1
@ManojKrVerma-vw4dx
@ManojKrVerma-vw4dx 6 ай бұрын
I could solve this by sliding window and multiset.
@jitesh_khurana
@jitesh_khurana 6 ай бұрын
Preety Good Easy Solution with multiset and sliding window int longestSubarray(vector& nums, int limit) { int ans = 1; int n = nums.size(); int i = 0; int j = 0; multiset st; while(j
@amar4429
@amar4429 6 ай бұрын
[1,5,6,7,8,10,6,5,6] limit:- 4 Answer = 5 can you explain this example please👃
@pokeindia5361
@pokeindia5361 6 ай бұрын
Bhaiya aapne bola tha weekend pe *longest valid parantheses* ka video daaloge... Please bhaiya ye important q h interview k liye
@empvaibhav9799
@empvaibhav9799 6 ай бұрын
Solve "Leetcode : 239. Sliding Window Maximum" before attempting this.
@aizad786iqbal
@aizad786iqbal 6 ай бұрын
i tried using in tree set in java..but it doesn't store duplicate elements..
@harmansingh722
@harmansingh722 6 ай бұрын
Which notepad do you use?
@ReshuSharma-jc7yu
@ReshuSharma-jc7yu 6 ай бұрын
Sir mereko kaise pata chalega ki isme heap use hoga question main ki nhi
@akashsaurabh9196
@akashsaurabh9196 6 ай бұрын
Why st.erase(st. Find(nums[i])) why not st. Erase(nums[i])??
@codestorywithMIK
@codestorywithMIK 6 ай бұрын
There are 3 variants of erase in multiset. 1) void erase (iterator position); 2) size_type erase (const value_type& val); 3) void erase (iterator first, iterator last); If you use 1st one, it will only delete the single element pointed by the iterator position. If you use 2nd one, it will delete all occurrences of that element from the multiset. We don’t want that here because we can have duplicate elements.
@Innovision2023
@Innovision2023 6 ай бұрын
Bhaiya tumara linkedin id thetho i will mention u in my leetcode acheivements
@codestorywithMIK
@codestorywithMIK 6 ай бұрын
Hey, That’s sweet of you ❤️ www.linkedin.com/in/mazhar-imam-khan-95a34ab3?
@MayankRathore-qi7qv
@MayankRathore-qi7qv 6 ай бұрын
sir mujhe yeh max heap ur min heap wala question smghj nhi aaya
@TUSHARKHANDELWAL-i8s
@TUSHARKHANDELWAL-i8s 6 ай бұрын
this question must be marked hard
@gui-codes
@gui-codes 6 ай бұрын
sahi me yaar.
@naive-fleek7420
@naive-fleek7420 6 ай бұрын
@@gui-codes nahi yarr multiset use krte ho toh bhot easy hai , easy medium hoga
@anish.naruto
@anish.naruto 6 ай бұрын
Sir, one thing i want to point out that you always take elements sorted in heaps.. But that's not always true in heaps, only the top element can be surely claimed as min or max... And heap structure changes on addition or deletion of elements to maintain that top value condition... So it's not good to talk like this that the max element will be in bottommost position in minheap or something like that. Though, i understand you're just taking that way to explain it better way but people can have misconception about heaps by this. Correct me if I'm wrong.
@ramandeepsingh8464
@ramandeepsingh8464 6 ай бұрын
@AbhishekAnand-u7u
@AbhishekAnand-u7u 6 ай бұрын
💥💥💥💥💥explain most optimized solution from leetcode solution section💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥
@deepanshuverma6237
@deepanshuverma6237 6 ай бұрын
rep++
@naive-fleek7420
@naive-fleek7420 6 ай бұрын
o(n) wala approach nahi bataye aap?
@varunkedia6729
@varunkedia6729 6 ай бұрын
Question says - difference b/w any two elements Then why are we talking diff of largest and smallest?
@gui-codes
@gui-codes 6 ай бұрын
See 5:03 in the video bro. The question say difference b/w any two elements MUST not exceed limit. So, for any subarray, instead of checking diference b/w every possible 2 elements pair (if they are crossing limit or not), you can simply check if the difference between highest and lowest number in that subarray is
@RahulJohn-sv8gz
@RahulJohn-sv8gz 6 ай бұрын
Can you make your video in english
@ks-xh4fq
@ks-xh4fq 6 ай бұрын
50 mins for 1 qs explanation ??
@AbhishekAnand-u7u
@AbhishekAnand-u7u 6 ай бұрын
please share your slides
@ago7506
@ago7506 6 ай бұрын
day-23 of saying lord🫡
@Engineering.Wallah
@Engineering.Wallah 6 ай бұрын
TLE //int n=nums.size(),ans=0; //for(int i=0;i
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
Max Chunks to Make Sorted - Leetcode 769 - Java
10:26
Code With K5KC
Рет қаралды 15
The Dome Paradox: A Loophole in Newton's Laws
22:59
Up and Atom
Рет қаралды 1,1 МЛН
What is mathematical thinking actually like?
9:44
Benjamin Keep, PhD, JD
Рет қаралды 25 М.
WHY did this C++ code FAIL?
38:10
The Cherno
Рет қаралды 298 М.
DSA & ₹1.2 Crore Per Annum Jobs - The Truth? (No Offence)
12:22
CodeWithHarry
Рет қаралды 738 М.
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 741 М.
Watch this before you start Coding! | 10 Tips for Coders
22:31
Apna College
Рет қаралды 2,2 МЛН
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН