Find the Kth smallest number using a heap
MediumConsider an unsorted array of numbers and an integer
k
, find the kth smallest number in the array.For example, if you're given the following inputs:
arr = [8, 2, 9, 4]k = 3
Your function should return the third smallest number
8
.Solution
9 Essential Trees & Graphs Coding Interview Problems
Master Trees & Graphs by trying the coding challenges below.
- 1.Inorder TraversalEasy
- 2.Tree SumEasy
- 3.Tree HeightEasy
- 4.LCAMedium
- 5.Max Path SumHard
- 6.Search mazeMedium
- 7.Number of islandsMedium
- 8.Kth SmallestMedium
- 9.Sort K ArraysHard