Solution Review: Find k Smallest Elements in the Array
Let’s solve the Find k Smallest Elements in an Array problem.
Statement
Given an unsorted array arr and an integer k, find the k smallest elements from the array using a Heap.
Constraints:
-
arr.length -
k