Algorithm · Meta · Medium
Requirements Given an unsorted array nums, return its k-th largest element. Use the following function signature: Your implementation must account for an empty array and for cases where k is greater than the number of elements. State how your solution handles those invalid requests. Follow-up questions: How would you support values arriving one at a time? How would the solution change if the interviewer asked for the k-th smallest value instead? How should repeated values be…
Checking your access…