Non-overlapping Intervals

Поділитися
Вставка
  • Опубліковано 19 жов 2024

КОМЕНТАРІ • 28

  • @mriduljain5801
    @mriduljain5801 Рік тому +2

    in both the cases there is one thing common to be pointed out that both cases that array should be sorted according to ending points
    class Solution {
    public:
    static bool comp(vector a, vector b){
    return a[1]

  • @JohnWickea
    @JohnWickea Рік тому

    ek to itni cute ,uper se coder ...haaye jaan hi logi kya 😇🥰❤❤

  • @MitrankShah
    @MitrankShah 2 роки тому +6

    Very very very good explanation! Thank you so much!!!

  • @tridibeshmisra9426
    @tridibeshmisra9426 7 місяців тому

    Thanks, ma'am for the simple explanation. I was stuck with the implementation for a long time.

  • @ishikaagrawal5648
    @ishikaagrawal5648 Рік тому +2

    in your first example you said intervals are not overlapping but they are overlapping so please modify that example otherwise students will get confused

  • @ajaybabupatel1665
    @ajaybabupatel1665 Рік тому

    Thanks for explaining in this very intutive way

  • @Raj10185
    @Raj10185 Рік тому

    very good explanation my code for same :-
    sort(intervals.begin(),intervals.end());
    int n = intervals.size();
    vector temp(2,0);
    temp[0]= intervals[0][0];
    temp[1]= intervals[0][1];
    int count =0;

    for(int i = 1 ; i < n ; i++)
    {


    int currst = intervals[i][0];
    int currend = intervals[i][1];


    if( currst < temp[1]) //overlapping
    {


    count++;


    //check for full merge overlapping then update the temp
    if(currst > temp[0] && currend < temp[1])
    {

    temp[0]= currst;
    temp[1]=currend;

    }






    }
    else //non overlapping just update the temp
    {

    temp[0]= currst;
    temp[1]=currend;



    }







    }


    return count;



    }

  • @satyamshukla1418
    @satyamshukla1418 3 роки тому

    The leetcode description was not very clear to me so i misunderstood and applied Lis which ran few test cases but this was very helpful .

  • @GauravSingh-ku5xy
    @GauravSingh-ku5xy 2 роки тому +1

    Thanks. Very good explanation.

  • @geekyNib
    @geekyNib Рік тому

    Amazing Explanation !!

  • @manasa1864
    @manasa1864 Рік тому

    Love (u) the way u teach ❤❤

  • @tridevthakur7711
    @tridevthakur7711 2 роки тому

    Feeling Laughs with proverb:" Killing 1 bird with 2 stones "

  • @amanshujaiswal4728
    @amanshujaiswal4728 Рік тому

    great explanation

  • @samyakjain7422
    @samyakjain7422 2 роки тому +1

    yrrr tum kitni cute ho...dayum beauty with brains....

  • @MilindGupta
    @MilindGupta 3 роки тому +2

    The first example which u took [1,5],[3,8],[10,15]. Here 3 is actually overlapping but u told it's not
    Anyways u cleared in further video

    • @probabilitycodingisfunis1
      @probabilitycodingisfunis1  3 роки тому +1

      Yes Milind, thanks for pointing it out, took the wrong example : )

    • @vinamrasangal8436
      @vinamrasangal8436 Рік тому

      abe saale milind jab clear ho gya tha tujhe toh comment karne ki kyu khujli hori

  • @jayanthotwani6200
    @jayanthotwani6200 Рік тому

    tysm nicely explained

  • @raushankumar6993
    @raushankumar6993 Рік тому

    Thanks a lot

  • @shatnuu_
    @shatnuu_ 5 місяців тому +1

    mam are you alive 🙄

  • @ashvinkumhar5819
    @ashvinkumhar5819 2 роки тому

    Thank you diiiiiiii

  • @shoryasinghal5241
    @shoryasinghal5241 Рік тому +1

    got it

  • @naveenkumarkota2090
    @naveenkumarkota2090 8 місяців тому

    are u in a hurry to go somewhere why are u explaining it very fast focus on that