Challenge: Find k Smallest Elements in a List
Try to solve the Find k Smallest Elements in a List problem.
We'll cover the following
Statement
Given an unsorted list lst
and an integer k
, find the k
smallest elements from the list using a Heap.
Constraints:
-
lst.length
-
k
-
lst[i]
Examples
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.