Ola SWE Interview Question 2022 June | Heaps | on-campus

Question · Posted Jun 2026

Question 1: Kth Largest Element in an Array Problem Statement Given an integer array nums and an integer k, return the k-th largest element in the array. Note that it is the k-th largest element in the sorted order, not the k-th distinct element. Can you solve it without sorting? Constraints 1 <= k <= nums.length <= 105 -104 <= nums[i] <= 104 Examples Example 1: Input: nums = [3, 2, 1, 5, 6, 4], k = 2 Output: 5 ...

The full answer & interview discussion are available to premium members.

Log in Create a free account