Minimum Number of Arrows to Burst Balloons 🔥| Leetcode 452 | Greedy | Sorting

Sdílet
Vložit
  • čas přidán 20. 08. 2024
  • Timestamps:
    Problem explanation: 01:50
    Approaching the problem: 02:00
    Dry Run: 04:39
    Code explanation: 08:49
    Complexity analysis: 10:35
    Time Complexity : O(nlogn)
    Space Complexity : O(1)
    Problem Link : leetcode.com/p...
    C++ Code Link :
    Please like, share and subscribe if you found the video useful. Feel free to ask in comments section if you have any doubts. :)
    #DataStructuresAndAlgorithms
    #greedy
    #interviewpreparation
    Minimum Number of Arrows to Burst Balloons solution
    Minimum Number of Arrows to Burst Balloons Leetcode
    Minimum Number of Arrows to Burst Balloons C++
    Minimum Number of Arrows to Burst Balloons Java
    Minimum Number of Arrows to Burst Balloons Python
    🔥🔥🔥🔥👇👇👇
    Join telegram channel for more updates on placement preparation : t.me/AyushiSha...
    Checkout the series: 🔥🔥🔥
    👉Interview Experiences : • Interview Experiences
    👉 Array: • Arrays
    👉 Linked List : • Linked List
    👉 Heap : • Heap
    👉 Recursion : • Recursion
    👉 Stack and Queue : • Stack And Queue
    👉 Greedy : • Greedy
    👉 Dynamic Programming : • Dynamic Programming
    👉 Leetcode contests : • Leetcode contests
    👉 Leetcode June Challenge : • Leetcode June Challenge
    👉 Leetcode July Challenge : • Leetcode July Challenge
    LIKE | SHARE | SUBSCRIBE 🔥🔥😊

Komentáře • 70

  • @PuneetKumar-uq4ru
    @PuneetKumar-uq4ru Před 2 lety +4

    Thanks a lot 😊 , feels like because of you I will go consistency solving problem everyday.

  • @ChandraShekhar-by3cd
    @ChandraShekhar-by3cd Před 2 lety +6

    Thanks a lot for the great explanation and consistency!

  • @TalhaTabrez7
    @TalhaTabrez7 Před 5 měsíci

    thank you! understood it well, was close to my intuition, but i didn't think about sorting the arrays within and was thinking the other way!

  • @borse2982
    @borse2982 Před rokem +1

    Thank you for explaining this problem in easier way..

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

    due to u,i got more confidence in coding

  • @user-er4hz8dg1g
    @user-er4hz8dg1g Před 5 měsíci

    thank you aisha akka

  • @everytimecricket8884
    @everytimecricket8884 Před rokem

    Clearly explained video and explanation

  • @RishabSharma6969
    @RishabSharma6969 Před 5 měsíci

    Thanks didi , great explaination.

  • @shatakshivishnoi916
    @shatakshivishnoi916 Před rokem

    clear explanation🙌

  • @gauravchauhan7195
    @gauravchauhan7195 Před rokem

    Great explanation.

  • @thegreekgoat98
    @thegreekgoat98 Před rokem

    Very nice explanation! Understood perfactly.

  • @ayushjain386
    @ayushjain386 Před 2 lety

    Thanx, for new approach ,i am doing this question ,merge interval

  • @SoumyaRanjanSahoo-kq4ez
    @SoumyaRanjanSahoo-kq4ez Před 5 měsíci

    nice explanation... very easy to undertand

  • @sumanshekhar8110
    @sumanshekhar8110 Před 8 měsíci

    It took some time to understand the if condition part, nevertheless nice explaination.

  • @RohitSaini52945
    @RohitSaini52945 Před 2 lety

    Thanks Ayushi! You are doing great job. Just one feedback - Before going into the actual solution please try to provide a dry run on any test case so that the question will be more clear to us.

  • @raj_kundalia
    @raj_kundalia Před rokem

    thank you!

  • @phaneendhrachinta7295

    Very Informative, Thank You

  • @suryavarma9760
    @suryavarma9760 Před 2 lety

    daily its a motivation, doing daily challenges with you.

  • @kholiyamails1257
    @kholiyamails1257 Před rokem

    thanks sis aag lgadi dont stop 😅

  • @sundarp7552
    @sundarp7552 Před 2 lety

    Clearly explained. Thank you for your video

  • @siddharthamishra7598
    @siddharthamishra7598 Před rokem

    Thanks so much for the video !!!!

  • @shreekrishna3453
    @shreekrishna3453 Před 2 lety

    wow, great explanation

  • @smile8510
    @smile8510 Před rokem

    Nice Explanation!

  • @jeeldasvani5015
    @jeeldasvani5015 Před 2 lety

    grt explanation ayushi as always

  • @Rahulyadav-oh3yp
    @Rahulyadav-oh3yp Před 2 lety

    I feel u solve the imp and problems whose chances of coming in interviews is mots! do u have any list of problems concatinated somehwere so that i solve those?
    like over some doc?

  • @AshwaniKumar-im6zb
    @AshwaniKumar-im6zb Před 2 lety

    Thanks Ayushi. It helps me alot.

  • @SoumikGhosh-ef1jn
    @SoumikGhosh-ef1jn Před 3 měsíci

    Maam I have tried writing down the solution in java :
    class Solution
    {
    public int findMinArrowShots(int[][] points)
    {
    Arrays.sort(points,(a,b)-> a[1]- b[1]);
    int end=points[0][1];
    int arrows=1;
    for(int i=1;iend)
    {
    ++arrows;
    end =points[i][1];
    }
    }
    return arrows;

    }
    }
    but just 1 test case is not getting executed :
    points =
    [[-2147483646,-2147483645],[2147483646,2147483647]]
    Output :
    1
    Expected :
    2
    Please help me out in rectifying the issue in my code ma'am.

  • @sejalmah
    @sejalmah Před 2 lety

    Thanks for being consistent !

  • @anshvashisht8519
    @anshvashisht8519 Před rokem +1

    anyone has java solution with same approach?

    • @yashchamoli8695
      @yashchamoli8695 Před rokem

      class Solution {
      public int findMinArrowShots(int[][] points) {
      Arrays.sort(points,(a,b)->a[1]-b[1]);
      int arrows=1;
      int end=points[0][1];
      for(int i=1;iend){
      end= points[i][1];
      arrows++;
      }
      }
      return arrows;
      }
      }
      but dont know why it fails in 1 case
      [[-2147483646,-2147483645],[2147483646,2147483647]] this one

  • @SavitarOP
    @SavitarOP Před 2 lety

    OP Solution

  • @desihiphop4998
    @desihiphop4998 Před 2 lety

    Di consistency ke liye respect++ !!!!!!!!

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

    Hii Ayushi dii, can you tell me How to get intership in good startup off campus ?

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

      Hi Darshan, keep looking for openings and if opening is there, then check if the job requirements matches your resume. In some startups, they ask DSA and in some they ask related to development or whatever skill they are looking for, so you need to prepare accordingly :)

    • @darshantrivedi5390
      @darshantrivedi5390 Před 2 lety

      @@AyushiSharmaDSA ohk thanks

  • @jaipurite8119
    @jaipurite8119 Před rokem

    int findMinArrowShots(vector& points) {
    int ans=1;
    sort(points.begin(), points.end());
    int xend=points[0][1];
    for(int i=1; i points[i][1])?points[i][1]:xend;
    }
    }
    return ans;
    }

  • @puneetkaur3061
    @puneetkaur3061 Před 2 lety

    Didi I wanted to ask you what effect does declaration of comparator inside and outside class have on complexity ?

  • @rohit_700
    @rohit_700 Před 2 lety

    Is this some kind of series',
    Found your channel on LinkedIn!!

  • @rishabhbatra3022
    @rishabhbatra3022 Před 2 lety

    why we not sort according to start, why with the end?

    • @AyushiSharmaDSA
      @AyushiSharmaDSA  Před 2 lety

      That can also be done :) try doing it with a test case

  • @pranavkumarparihar1397

    Thanks di

  • @maddycoder1294
    @maddycoder1294 Před rokem

  • @samlinus836
    @samlinus836 Před rokem

    Nice xplanation sis
    However if you are workin on java...
    * [[-2147483646,-2147483645],[2147483646,2147483647]] this testcase might fail if you use
    Arrays.sort(intervals, (a, b) -> a[0] - b[0]); to sort the array...
    Now I did a quick analysis on why it doesn't work?
    You would understand it clearly if you clearly understand the working mechanism of compare(a-b)
    #Analysis
    if(a-b) is > 0 means, b comes before a
    else if (a-b) b)||(a