Insert and Find Kth Largest

Asked at GoogleOnsite

Reported by the problem's creator, not verified

LargestFinder() starts with no numbers and keeps every number it is given, repeats included.

Examples

  1. Example 1

    Input: init = [], operations = [["insert",[3]],["insert",[3]],["insert",[2]],["find_largest",[0]],["find_largest",[1]],["find_largest",[2]]]

    Output: [null,null,null,3,3,2]

    Explanation: Inserting 3, 3, 2 gives the values 3, 3, 2 in descending order. find_largest(0) is 3, find_largest(1) is the second 3 because duplicates count, and find_largest(2) is 2.

Import your own questions
Paste a question you were asked and get a full problem: statement, tests and a checked solution.
Import a question

Code

Loading editor…

Ln 1, Col 1

Start an attempt to use Coach.