Algorithm · Microsoft · Medium
This problem is an adaptation of the familiar task of finding the kth largest value in an array. Completing that problem beforehand may be useful. Given an integer array nums together with an integer k, produce the k greatest elements contained in nums. Their order in the returned result is unrestricted. When repeated values are part of the top k, return every qualifying occurrence. Constraints: 1 ≤ k ≤ nums.length 1 ≤ nums.length ≤ $$10^6$$ $$-10^9$$ ≤ nums[i] ≤ $$10^9$$…
Checking your access…