LeetCode 23. Merge k Sorted Lists[ Algorithm + Code Explained]

Поділитися
Вставка
  • Опубліковано 16 вер 2024
  • One of the most frequently asked coding interview questions on Linked List in companies like Google, Facebook, Amazon, LinkedIn, Microsoft, Uber, Apple, Adobe etc.
    LeetCode : Merge k Sorted Lists
    Problem URL - leetcode.com/p...
    Question :Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
    Example:
    Input:
    [
    1-4-5,
    1-3-4,
    2-6
    ]
    Output: 1-1-2-3-4-4-5-6
    Connect with me on LinkedIn at: / jayati-tiwari

КОМЕНТАРІ • 14

  • @biranchinarayanpadhi9067
    @biranchinarayanpadhi9067 4 роки тому +23

    Hello Jayanti, one suggestion is before directly solving problems , you can use your notepad to discuss your approach . Here notepad means anything from ipad or any tablet which enables you to write or take notes. Using that you can discuss your approach and then solve the problem.

  • @jiteshkumar3112
    @jiteshkumar3112 4 роки тому +1

    Hi Ma'am. how can i get cheat sheet of approaches to solve LL problems. you have that of other data structures too?

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

    @jayati can you post solving method ppt, this was very helpful.

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

    I appreciate a lot for your lecture! However, I have something do not understand. What's the meaning of the "lists[index1]=ans.next"?

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

      She is returning lists[0]. So, inserting the solution at index1. ans.next will be the actual starting point because ans is initialized with '-1'.

  • @MakrandPatil17
    @MakrandPatil17 4 роки тому +1

    Why not use heap?

    • @jayatitiwari444
      @jayatitiwari444  4 роки тому +3

      That needs extra space

    • @code7434
      @code7434 4 роки тому +1

      @@jayatitiwari444 nice solution. Got to know different way to think

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

    Areeeeee
    Kiu nehi karta iss Q ko koi heap see

  • @ShreyaSingh-vr9qi
    @ShreyaSingh-vr9qi 4 роки тому +1

    Thanks for your effort in making the video !! But most of the guys use editorial for understanding the concept not solution. So, please if u can first explain the concept on a white board will be more better.

  • @surajgrandhi6742
    @surajgrandhi6742 4 роки тому

    Mam I am getting time limit exceeded for the same code.

  • @venkatabhavanbharadwaj4564
    @venkatabhavanbharadwaj4564 4 роки тому

    Could you please make solutions in cpp... Mam

  • @sumanthsaadam4522
    @sumanthsaadam4522 4 роки тому +6

    Entry sound of your video is so annoying!