MERGE INTERVALS || LeetCode 56 || Hindi Solution

Sdílet
Vložit
  • čas přidán 23. 05. 2021
  • Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
    NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. Question Name:
    MERGE INTERVALS
    Question Statement:
    1. Given an array of Intervals , return merged overlapping intervals.
    2. For more detail watch the video.
    Topic: #Array #Sort #Scheduling #OOPS
    Used #DataStructure: #Arrays #Lambda Expression
    #TimeComplexity: O(nlogn)
    #SpaceComplexity: O(n)
    --------------------------------------------------------------
    Smimilar Questions: N/A
    ---------------------------------------------------------------
    For detailed information and other exercises, VISIT: www.pepcoding.com
    Have a look at our result: www.pepcoding.com/placements​
    Follow us on our FB page: / pepcoding​
    Follow us on Instagram: / pepcoding​
    Follow us on LinkedIn: / pepcoding-education
    ----------------------------------------------------------------
    #Array #Sort #Lambda_Expression #LeetCode #Array-and-String #GfG
    For a better experience and more exercises, VISIT: www.pepcoding.com/resources/o...
    Have a look at our result: www.pepcoding.com/placements
    Follow us on our CZcams page: / pepcoding
    Follow us on our FB page: / pepcoding
    Follow us on Instagram: / pepcoding
    Follow us on LinkedIn: / pepcoding-education
    Follow us on Pinterest: / _created
    Follow us on Twitter: home
    .
    .
    .
    Happy Programming !!! Pep it up 😍🤩
    .
    .
    .
    #pepcoding #code #coder #codinglife #programming #coding #java #freeresources #datastrucutres #pepcode #competitive #competitiveprogramming #softwareengineer #engineering #engineer

Komentáře • 103

  • @vishalverma2986
    @vishalverma2986 Před rokem +1

    amazing....

  • @nikhilkumar-ux7xs
    @nikhilkumar-ux7xs Před měsícem

    clear and easy explanaton

  • @radhusingh2915
    @radhusingh2915 Před rokem

    Outstanding Explanation Sir...

  • @mayanksahu7607
    @mayanksahu7607 Před 7 měsíci

    Best explanation ❤ Thankyou sir

  • @syntaxerror7592
    @syntaxerror7592 Před rokem

    Best Explanation ever !!!

  • @RanveerAllhabadia
    @RanveerAllhabadia Před rokem

    God level Expalination!

  • @munendragaur4965
    @munendragaur4965 Před rokem

    bhiya best explanation

  • @amanpreetkaur1738
    @amanpreetkaur1738 Před rokem

    Thank You

  • @killerDevil3763
    @killerDevil3763 Před rokem +1

    bestest explaination ever vedio esi pure u tube pe explaination ni h esi, vedio half dekhte hi subscribe kar diya, osam bro, keep it up.

  • @nextlevel9780
    @nextlevel9780 Před 2 lety

    Kudos to pepcoding

  • @KyuriousBot
    @KyuriousBot Před rokem +2

    One of the most underrated channels out there! Always the code is written in an easy-to-read and understandable manner! The explanation was also excellent!

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

    Thank you for the great explanation, btw
    Sorting algo = positive means swap the value, negative and zero means no swap...

  • @Y_bhav
    @Y_bhav Před 6 měsíci

    Best and easiest explanation of merge interval question on CZcams.

  • @killerDevil3763
    @killerDevil3763 Před rokem

    itna detail me samzhaya h ki code first time me hi run ho gya mera, thanks

  • @satyamshubham8177
    @satyamshubham8177 Před 2 lety +6

    Hands down the best explanation for this question. Covered every aspect of the problem and the code in detail. Kudos to you and thank you!!💯💯

  • @faizanhaider3953
    @faizanhaider3953 Před rokem

    Puraa IT ilaka aap to DuuuAaan DuuuAaan kr diye..... Mst explanation

  • @ishaarora3
    @ishaarora3 Před rokem

    very well explained and easiest solution out of all videos I watched. Thank you so much

  • @Caroline-up8qw
    @Caroline-up8qw Před rokem

    I have not seen this kind of explanation on CZcams .. really helpful sir..

  • @thewhitewolf8974
    @thewhitewolf8974 Před 2 lety

    Best solution ever on you tube 💯💯💯

  • @chiragdevnani7283
    @chiragdevnani7283 Před 2 lety

    The best explanation available on the internet.

  • @HarshKumar-nh6be
    @HarshKumar-nh6be Před 3 lety +1

    Great great great explanation sir best teacher 👍👏👌😀🙌😊

  • @subscribeinsteadlike2768

    So detailed explanation hatss offf mannnnn

  • @siddharthupadhyay4246
    @siddharthupadhyay4246 Před 2 lety

    One of the best explanations on this.

  • @analyticswithjaspreet
    @analyticswithjaspreet Před 2 lety +5

    Best Solution ever !! , thank you @pepcoding
    for leetcode use interval[0]

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @pmsb_999
    @pmsb_999 Před 2 lety

    Excellent explanation. Great work!!

  • @ahmadhamzakhan8903
    @ahmadhamzakhan8903 Před 2 lety

    Literally this is the best and detailled explanation ever for this problem......🙌🙌🙌

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

    you are amazing. I couldn't find a better solution to this question.

  • @shubhamkhuntia2412
    @shubhamkhuntia2412 Před 2 lety

    kya khoob smjha rhe ho bhai ! Mindich blowing

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Glad you liked it!
      For better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @aashukumar1348
    @aashukumar1348 Před 2 lety

    Explanation is 🔥🔥🔥

  • @Real_Dk
    @Real_Dk Před 2 lety

    Best tutorial i have ever seen in my entire life ..❤️

  • @hritickkumarjha804
    @hritickkumarjha804 Před 2 lety

    very good explanation loved it sir

  • @amitsharma758
    @amitsharma758 Před 3 lety +2

    Nothing batter than this, such a great explanation

    • @Pepcoding
      @Pepcoding  Před 3 lety

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
      If you like our efforts, we request a review
      g.page/Pepcoding/review?rc
      You can subscribe to our channel here
      czcams.com/users/Pepcodingabout?view_as=subscriber
      For clearing your doubts, you can join our community on telegram
      t.me/pepcoding

  • @sarthak9448
    @sarthak9448 Před rokem

    Please provide solutions in cpp, it will be helpful

  • @srjop5566
    @srjop5566 Před 2 lety

    you are amazing. thank you sir 🤗

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Glad you liked it!
      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @photowala7216
    @photowala7216 Před 3 lety

    hatsoff bro I am too preparing for placements

  • @abhimanyusharma2919
    @abhimanyusharma2919 Před 3 lety

    Mohit bhaiya excellent explanation.

  • @AYJ959
    @AYJ959 Před 2 lety

    amazing bhai❤❤

  • @birajasamal7066
    @birajasamal7066 Před rokem

    Thanks great explanation but we can optimise it in O(n) i.e. without sorting it

  • @pubg-kg2uj
    @pubg-kg2uj Před 3 lety +2

    Excellent explanation sir🔥🔥🔥

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thank you so much and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @RAHUL-ks8ft
    @RAHUL-ks8ft Před 2 lety

    100 times clapping bhai for you
    i salute u

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @sudheer4866
    @sudheer4866 Před 2 lety

    Excellent explanation. Great work!! ❤️❤️❤️❤️❤️❤️😍😍😍

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Glad you liked it! For better experience and well organised content sign up on nados.io
      You can also post your queries on community section of NADOS.

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Thank you! Cheers!
      Sign up on nados.io today. You will get the better experience and precisely arranged content.

  • @rishabhmaurya6103
    @rishabhmaurya6103 Před 3 lety

    it is best explanation sir thanku very much

    • @Pepcoding
      @Pepcoding  Před 3 lety

      So nice of you and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @uttamyadav7172
    @uttamyadav7172 Před 3 lety

    Great explanation

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Glad it was helpful! and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @akashnigam5565
    @akashnigam5565 Před rokem +1

    in the code at line 18 there should be

  • @aashishgoyal1436
    @aashishgoyal1436 Před 3 lety +2

    Just wow. U shud come and teach very often sir. u are too good

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

      wow, this cheers me up. I am glad we at pepcoding could be of help to you. Keep learning. Also, recommend us to your juniors and peers, they may also benefit.

    • @aashishgoyal1436
      @aashishgoyal1436 Před 3 lety

      @@Pepcoding sure sir🙏

    • @freshcontent3729
      @freshcontent3729 Před 3 lety

      what is the TC of this solution ?

  • @vasugaur1283
    @vasugaur1283 Před 3 lety

    bhaiiiiisaaab mazaaa agya .....notes bhi banane ki zarurat nhi padhi.... best explanation bhaiya 👌👌👌💯

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thank you so much and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @ajayshankhwar730
    @ajayshankhwar730 Před 3 lety

    thank you fir such a brief explanation about everything......that somehow motivates me a lot.

  • @VikasYadav-fu8cq
    @VikasYadav-fu8cq Před 2 lety

    very well explained brother . Thanks for your hard work . keep it up.

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

      Hope you love the explanation, for better experience and well organised content sign up on nados.io and start learning.

  • @kakarrotgaming6052
    @kakarrotgaming6052 Před 3 lety

    Sir exellent explanation 👌👌👌

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thanks and welcome Keep watching

  • @kanishkasaini3068
    @kanishkasaini3068 Před 3 lety

    Very good explanation

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thanks for liking and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @prashantagrawal1140
    @prashantagrawal1140 Před 2 lety +5

    it should be interval[0]

  • @vivekjaiswal3663
    @vivekjaiswal3663 Před 3 lety +2

    explanation of mohit sir is so good that this video has 0 dislikes

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thank you so much and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @amanavengeraman
    @amanavengeraman Před 3 lety

    Great

    • @Pepcoding
      @Pepcoding  Před 3 lety

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
      If you like our efforts, we request a review
      g.page/Pepcoding/review?rc
      You can subscribe to our channel here
      czcams.com/users/Pepcodingabout?view_as=subscriber

  • @RohitChaurasiyalisten

    Sorting--->
    public class Sorting {

    public static int[][] checkSort(int Interval [][]){

    Arrays.sort(Interval,(a,b) -> Integer.compare(b[0], a[0]));
    System.out.println(Arrays.deepToString(Interval));
    return Interval;
    }

    public static void main(String[] args) {
    int arr[][] = {{6,8},{1,9},{2,4},{4,7}};
    checkSort(arr);
    }
    }

  • @letsdoeverythinginoneweek9398

    nice nice very very nice
    gajaaab
    bahut badiya
    aur taarif karna ka liaa words nahi bachhhhahahahaahah

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

      Glad to know that you liked the content and thank you for appreciating.
      The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos.
      So, keep motivating, keep learning and keep loving Pepcoding😊

  • @crazymemes4080
    @crazymemes4080 Před 3 lety

    Mohit sir OP ❤️❤️

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thank you so much and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @anujkhare3815
    @anujkhare3815 Před 2 lety

    can anyone mention ful name of mohit sir , so that i can connect with him on linkedin

  • @ShubhamSharma-zb9uh
    @ShubhamSharma-zb9uh Před 3 lety

    Sir One Doubt you told that interval [0]

    • @VishalSingh-er2bl
      @VishalSingh-er2bl Před rokem

      bhai aisa isliye ho raha qki leetcode platform p jo question h usme = k sign ko consider karna hai but pepcoding k platform p jo question h usme = sizn ko consider nhi krna.

  • @shriramprajapati
    @shriramprajapati Před rokem

    class Solution {
    public:
    vector merge(vector& intervals)
    {
    vectormergedIntervals;
    sort(intervals.begin(),intervals.end());
    for(auto interval:intervals)
    {
    if(mergedIntervals.size()==0)
    {
    mergedIntervals.push_back(interval);
    }
    else
    {
    vectorpreinterval = mergedIntervals.back();
    if(interval[0]

  • @raja17
    @raja17 Před 2 lety

    Can we use stack here?

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

    sir i have a doubt actually its not question specifically but when you taken the last element arraylist in prevlist and do the updates on prevlist accordingly but the arraylist getting updated automatically can u explain why its happening???pls help

  • @laxmanbafna4178
    @laxmanbafna4178 Před rokem

    Every other video on this topic it's Max 17 minutes. This one is 37 minutes giving detailed explanation hats off

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

    One doubt: Last Line: list.toArray(new int[list.size()][]); takes extra time/memory to convert?
    It makes a deep copy or shallow copy?
    Would it be better if we create a 2-d array instead of arraylist and use normal for loop for indexing?

    • @snehaashishgupta1254
      @snehaashishgupta1254 Před 3 lety

      yeah I was also wondering the same... but then memory would be wasted as intervals are merged and we don't know how many intervals would be there once we merge it....

    • @muditjain9117
      @muditjain9117 Před 3 lety

      @@snehaashishgupta1254 you dont need to worry about that because list.toArray makes shallow copies so we are safe. It creates a list of pointers which are pointing towards 1d arrays present in heap.

    • @snehaashishgupta1254
      @snehaashishgupta1254 Před 3 lety

      @@muditjain9117 ok

    • @snehaashishgupta1254
      @snehaashishgupta1254 Před 3 lety

      @@muditjain9117 so basically shallow copies are pointing to heap while deep copies are made in the the stack with a separate object in heap

    • @muditjain9117
      @muditjain9117 Před 3 lety

      @@snehaashishgupta1254 yes.

  • @gauravsingh4355
    @gauravsingh4355 Před 3 lety

    ezzzy pizzy lemon squezzy o O

  • @abhinavsingh-zc2hk
    @abhinavsingh-zc2hk Před 3 lety

    Very Low Volume Sir

  • @photowala7216
    @photowala7216 Před 3 lety

    algorithm csgo remember bro😂

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

    Please use white board