Merge Intervals 🔥🔥 | Arrays | Love Babbar DSA Sheet
Vložit
- čas přidán 3. 08. 2021
- Time complexity - O(nlogn)
Space complexity - O(n)
Problem Link: leetcode.com/problems/merge-i...
C++ Code Link : github.com/Ayu-99/Love-Babbar...
Python Code Link: github.com/Ayu-99/Love-Babbar...
Please like, share and subscribe if you found the video useful. Feel free to ask in comments section if you have any doubts. :)
#DataStructuresAndAlgorithms
#LoveBabbarDSASheet
#interviewpreparation
Merge Intervals solution
Merge Intervals Leetcode
Merge Intervals C++
Merge Intervals C++ Hindi
Merge Intervals Hindi
Checkout the series: 🔥🔥🔥
👉 Arrays : • Arrays
👉 Recursion : • Recursion
👉 Stack and Queue : • Stack And Queue
👉 Greedy : • Greedy
👉 Leetcode contests : • Leetcode contests
👉 Leetcode June Challenge : • Leetcode June Challenge
👉 Leetcode July Challenge : • Leetcode July Challenge
LIKE | SHARE | SUBSCRIBE 🔥🔥😊
This is a nice problem, this is in Algo expert as well. Also, the foundation for a more complex problem - "find possible meeting time (say for 30 mins) of 2 people given individual's meeting fixtures"
The simplest way of explanation of this question i found on youtube .Thanks a lot Ayushi
Amazing explanation ,, In other videos nobody is telling what is merging actually but you tell the logic behind it.. Don't have words admire your skill ... thank you so much
Thank you so much Yash, glad it was helpful :)
very very Amazing explanation and can i say, I have no word for your explanation style, i have watch many videos but I had not satisfied
One of the best explanations
your explanation is amazing i understood very well thank you so much for providing this question
Welcome Ajeet, glad it was helpful 😄
Diiii plz keep making videos of this sheet ,Ur style of explaining eevery problem is indeed so noice ,Ty for this🔥
Yes Pranjal I will :), glad it was helpful
Using maps makes this problem easy , since maps use RB-trees for sorting and 1 iteration , so complexity will be n(logn)
I really like your explanation and indeed your voice. Keep doing great work💯😇
Thank you Akanksha, glad it was helpful :)
Thankyou so muuch Ayushi Sharma I was really pissed off because of this problem n didnt understand the explanation of many youtubers then came accross your video and now everything is cleared so well that i coded myself!!!!!!!!!!!!
Awesome Saad, glad it was helpful 😍🤗
Didi apke teaching pe pyar agaya
🥹🥹😊
💯💯
Very nice
Well explained, 💝
Thanks 😊
best explanation : )
Thank you :)
Waaah didi ji waaah 😁👍 great
Thank you 😁
@@AyushiSharmaDSA didi ek question aur please.... Ye bata dijiye ki devlopment mai kitna accha hona hai... Means maine approx 4 hours each day dekr approx 6 months devlopment ki hai..
Ek college website banai hai approx 1000 students use kr rahe hain... And
1 covid19 tracker.
React and nodejs se..
Kya itna enough hai ya abi aur abi internship ni hui hai koi....
@@HarshitSharma-cb7dx Hi Harshit, Its a good project. Iss tech mein internship lene ka try kro iss project ke basis pr
i don't understand what you did in sorting([]vector&a,vector&b) what is this and what is the need of writing this my code is submitted without using this
??
Easiest ever
Wah didi wah 😂
Superb
Thanks Sarvesh 🤗
Mam aapka samzane ka tarika bahut accha hai. I appreciate
Plz jaldi se love babbar k 450 questions ki series complete karo na.
Vaise mam ek baat batao : - Aapne relevel exam k baare mein suna hai kya?
Hi Vishwanath, sure
I have heard about the exam, but not given it :)
Using Map solution :
#include
#include
#include
#include
#include
using namespace std;
map mergeInterval(vector intervalVec) {
vector resultVec;
map intervalMap;
// insert in to map
for(auto i:intervalVec) {
intervalMap[i.first] = i.second;
}
auto it = intervalMap.begin();
it++;
for(auto i = intervalMap.begin();it != intervalMap.begin();i++,it++) {
if(i->second >it->first ) {
// merge here
i->second = it->second;
intervalMap.erase(it);
}
}
return intervalMap;
}
int main() {
// INPUT in verctor of pairs
vector intervalVec = {make_pair(1,3),make_pair(2,6),make_pair(8,10),make_pair(15,18)};
map intervalMap = mergeInterval(intervalVec);
for(auto i:intervalMap) {
cout
Best explanation 👌
Thank you, glad it was helpful 🙂😊
Mam aapne ye code karne mein jyadatar jagah par standard template library functions ka use Kiya hai kya? Plz reply
Hi, I have used inbuild sort function
Saach bolu toh sort function ke Aandar kya likha hy kuch samaj nhi aaya 🥲konsa topic array ka miss kiya hy may nay joh ki muje ye intervals , compare , .end() , .begin() , &a &b samaj nhi aah rha koi toh plzz bata do ........???????
Vector ka topics
Great video.
Do you use tablet?which one?
Which android application do you use?
I use mouse. Only :)
@@AyushiSharmaDSA any android app?
@@ankitthawal1313 nothing
Curr[1] & inveral[I][1] ?????
i have watched many of ur videos and i salute u for the way u explain the problems 🫡.
thank you so much 🤗, glad they are helpful..
The question can be solved without using sorting. 🙂
Did u solved love Babbar sheet before applying for walmart test
?? Pls reply although I think all Coaching institute have exactly same no of questions which have been randomly asked in previous years
Yes, I have done this sheet :)
@@AyushiSharmaDSA ok 🙂
Mam if possible include Java code also😅
Sure Yash :)