Algorithm · Google · Hard
Requirements insert(num: int) — place num into the collection, and retain repeated values. findLargest(k: int) — produce the item at position (k+1) after arranging all inserted numbers from greatest to least, counting equal values separately. findLargest(0) returns the greatest inserted number. findLargest(1) returns the next entry in descending order; it can match findLargest(0) when duplicates exist. Prioritize making findLargest efficient; the performance of insert…
Checking your access…