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...
Thanks I feel this question is easy to code but hard to think of.
this doesn't seem to work if there are duplicate?
Why is the optimal solution O(N)? Storing 4 mins/maxes into the PQ would take O(NlogN). Wouldn't it?
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.
It was fun