Google Coding Interview Question | Leetcode 1509 | Min Diff Between Max and Min Value in Three Moves

Поділитися
Вставка
  • Опубліковано 26 сер 2024
  • In this video, we introduce how to solve the "Minimum Difference Between Largest and Smallest Value in Three Moves" question which is used by big tech companies like Google, Facebook, Amazon in coding interviews. We also cover how to behave during a coding interview, e.g. communication, testing, coding style, etc.
    Please subscribe to this channel if you like this video. I will keep updating this channel with videos covering different topics in interviews from big tech companies.
    Problem classification (e.g. data structure, algorithm, company, leetcode) and video link: docs.google.co...

КОМЕНТАРІ • 6

  • @yitingg7942
    @yitingg7942 3 роки тому +6

    Thanks I feel this question is easy to code but hard to think of.

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

    this doesn't seem to work if there are duplicate?

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

    Why is the optimal solution O(N)? Storing 4 mins/maxes into the PQ would take O(NlogN). Wouldn't it?

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

      At a time you would have only 4 values in the heap. I supposes its N log 4 which is N since log 4 is a constant.
      Hope it is clear.

  • @jay-rathod-01
    @jay-rathod-01 3 роки тому

    It was fun