Google Coding Interview Question - Merge Two Sorted Lists - Leetcode 21

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

Комментарии • 14

  • @GregHogg
    @GregHogg  7 месяцев назад +2

    Master Data Structures & Algorithms For FREE at AlgoMap.io!

    • @zia44ful
      @zia44ful 7 месяцев назад

      Thank you, I like your shorts on leetcode problem. If you provide the leetcode problem number in the beginning of the video, I can pause and give it a try myself and then look into your solution.

  • @pratyushabhadra5875
    @pratyushabhadra5875 7 месяцев назад +8

    Use priority queue min heap...put all elements in that and then pop one by one and keep on adding to new LinkedIn list

    • @taranjitlotey9502
      @taranjitlotey9502 7 месяцев назад

      Linked list is too complex for this

    • @shrayesraman5192
      @shrayesraman5192 7 месяцев назад

      That is more than one pass

    • @firstyfirst
      @firstyfirst 7 месяцев назад +2

      nlogn ......... but we need it in kinear time

    • @jojoc.1171
      @jojoc.1171 7 месяцев назад

      Priority queue for solving merge K sorted lists

  • @benmarcus3044
    @benmarcus3044 6 месяцев назад +1

    Why not just create a new list and add to it all the elements?

  • @Islandboyq
    @Islandboyq 6 месяцев назад

    What does concatenate mean?

    • @GregHogg
      @GregHogg  6 месяцев назад

      Concat([1,2], [3,4]) = [1,2,3,4]

  • @paulkeating9259
    @paulkeating9259 7 месяцев назад +2

    Im sad that I understand the start reference :(

    • @GregHogg
      @GregHogg  7 месяцев назад +2

      Why, avril is great

    • @davisuga
      @davisuga 6 месяцев назад

      @@GregHogg But its old lol

  • @vigneshreddy1213
    @vigneshreddy1213 7 месяцев назад +1

    merge function in merge sort? solving k-sorted lists may be little trick