Kth Largest Element in a Stream
Google Interview Question
Problem Overview
Difficulty: Easy
Implement a class named KthLargest that keeps track of test scores and always tells us the kth highest score after each new submission.
Original Input:
· k = 2
· nums = [2, 4, 5, 8]
add(1)
· Output = 5
· Reason: 2nd highest score is 5
add(9)
· Output = 8
· Reason: 2nd highest score is 8Keep reading with a 7-day free trial
Subscribe to Harpreet's Newsletter to keep reading this post and get 7 days of free access to the full post archives.

