Merge Intervals 🔥🔥 | Arrays | Love Babbar DSA Sheet

Sdílet
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 🔥🔥😊

Komentáře • 58

  • @AstraRudra
    @AstraRudra Před 3 lety +4

    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"

  • @I_Am_THE_PSK
    @I_Am_THE_PSK Před rokem +1

    The simplest way of explanation of this question i found on youtube .Thanks a lot Ayushi

  • @sinister_rules
    @sinister_rules Před 2 lety +2

    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

  • @kamalpandit2101
    @kamalpandit2101 Před rokem

    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

  • @hiteshpanchal5772
    @hiteshpanchal5772 Před rokem

    One of the best explanations

  • @ajeetbharati6948
    @ajeetbharati6948 Před 2 lety +2

    your explanation is amazing i understood very well thank you so much for providing this question

  • @pranjaladhav9600
    @pranjaladhav9600 Před 2 lety +1

    Diiii plz keep making videos of this sheet ,Ur style of explaining eevery problem is indeed so noice ,Ty for this🔥

  • @amitnadiger
    @amitnadiger Před 3 lety

    Using maps makes this problem easy , since maps use RB-trees for sorting and 1 iteration , so complexity will be n(logn)

  • @akankshajha1773
    @akankshajha1773 Před 2 lety +1

    I really like your explanation and indeed your voice. Keep doing great work💯😇

  • @ITsaadsayyed
    @ITsaadsayyed Před rokem

    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!!!!!!!!!!!!

  • @anupn5945
    @anupn5945 Před rokem

    Didi apke teaching pe pyar agaya

  • @mayankjoshi8888
    @mayankjoshi8888 Před 3 lety

    💯💯

  • @TestAccount-ej7cz
    @TestAccount-ej7cz Před 3 lety

    Very nice

  • @codingchampians7268
    @codingchampians7268 Před 2 lety +1

    Well explained, 💝

  • @InderjeetSingh-eb8py
    @InderjeetSingh-eb8py Před 2 lety

    best explanation : )

  • @HarshitSharma-cb7dx
    @HarshitSharma-cb7dx Před 3 lety +1

    Waaah didi ji waaah 😁👍 great

    • @AyushiSharmaDSA
      @AyushiSharmaDSA  Před 3 lety +1

      Thank you 😁

    • @HarshitSharma-cb7dx
      @HarshitSharma-cb7dx Před 3 lety +2

      @@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....

    • @AyushiSharmaDSA
      @AyushiSharmaDSA  Před 2 lety

      @@HarshitSharma-cb7dx Hi Harshit, Its a good project. Iss tech mein internship lene ka try kro iss project ke basis pr

  • @shivanshbhardwaj6561
    @shivanshbhardwaj6561 Před 2 lety +1

    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
    ??

  • @_tan2112
    @_tan2112 Před rokem

    Easiest ever

  • @pratyushtripathi1728
    @pratyushtripathi1728 Před 9 měsíci +1

    Wah didi wah 😂

  • @sarveshsakpal8241
    @sarveshsakpal8241 Před 2 lety

    Superb

  • @vishwanathhosmane3834
    @vishwanathhosmane3834 Před 2 lety

    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?

    • @AyushiSharmaDSA
      @AyushiSharmaDSA  Před 2 lety

      Hi Vishwanath, sure
      I have heard about the exam, but not given it :)

  • @amitnadiger
    @amitnadiger Před 3 lety

    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

  • @dibyajyotimahuri4891
    @dibyajyotimahuri4891 Před 2 lety

    Best explanation 👌

  • @vishwanathhosmane3834
    @vishwanathhosmane3834 Před 2 lety

    Mam aapne ye code karne mein jyadatar jagah par standard template library functions ka use Kiya hai kya? Plz reply

  • @premmane9816
    @premmane9816 Před 2 lety +1

    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 ........???????

  • @ankitthawal1313
    @ankitthawal1313 Před 3 lety

    Great video.
    Do you use tablet?which one?
    Which android application do you use?

  • @jayeshnayee6735
    @jayeshnayee6735 Před rokem

    Curr[1] & inveral[I][1] ?????

  • @jagmohangautam1062
    @jagmohangautam1062 Před 4 měsíci

    i have watched many of ur videos and i salute u for the way u explain the problems 🫡.

  • @saunaknandi1814
    @saunaknandi1814 Před 2 lety

    The question can be solved without using sorting. 🙂

  • @Coding_Student144
    @Coding_Student144 Před 3 lety +1

    Did u solved love Babbar sheet before applying for walmart test

    • @Coding_Student144
      @Coding_Student144 Před 3 lety

      ?? Pls reply although I think all Coaching institute have exactly same no of questions which have been randomly asked in previous years

    • @AyushiSharmaDSA
      @AyushiSharmaDSA  Před 3 lety +1

      Yes, I have done this sheet :)

    • @Coding_Student144
      @Coding_Student144 Před 3 lety +1

      @@AyushiSharmaDSA ok 🙂

  • @sinister_rules
    @sinister_rules Před 2 lety +1

    Mam if possible include Java code also😅