Write code to find nth largest number from a stream of numbers.
Solution:
Use a n size min heap.
Create a n-size min-heap. nth largest will be always at the root of the heap
Data structures, Algorithms, Coding, Technical Interview Questions and much more. (Still work in progress)
0 comments:
Post a Comment