Kth Largest Element in a Stream - Leetcode 703

preview_player
Показать описание


#coding #leetcode #python
Рекомендации по теме
Комментарии
Автор

Idk why but whenever I solve a problem, that day I come across your short with explanation of the same problem

avhhust
Автор

Would it not be slightly more efficient in the long run to add extra elements that are out of bounds in the beginning if you have less than k? This way when you call the add method you don’t have to check the length, can just push and pop

Bingiemingie
Автор

Maybe a dumb question but why Kth instead of Nth

jasongaming
Автор

Is it common to be able to use built in heap library?

Omar-grkm
Автор

can you please explain why heapify takes O(n) time but its technically not sorting it's kinda confusing

pastori
Автор

Why would you care about the size of the heap? Wouldn't you just pop it k times even if it contained all n elements

jewsefjones
Автор

When will people realize that they sre just wasting their time and energy in leetcode, for fks sake its not used anywhere except for interviews, make things with real technology, study system design, dont do this mind twister dsa bllshit

NoturBusinesstoKnow
Автор

It seems the algorithm is in O( n . log(k) ) temporal and O(k) spatial.

_Holy_Lance_
join shbcf.ru