Challenge: Find K Largest Elements in the List

Try to solve the Find K Largest Elements in the List problem.

We'll cover the following

Statement

Given a list of integers, nums, and a positive integer, k, find the k largest elements in the list.

Constraints:

  • 11 \leq k \leq nums.length 103\leq 10^3

  • 104-10^4 \leq nums[i] 104\leq 10^4

Example

Let’s take a look at a few examples to get a better understanding of the problem statement:

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.