Problem Brief
Kth Smallest in Subarray π
OA
See Amazon online assessment and hiring insights
Given an array arr, return the kth smallest integer for each subarray of size m.
1Example 1
Input
arr = [3, 1, 4, 2], k = 2, m = 3
Output
[3, 2]
Explanation
In the first subarray of size 3 ([3,1,4]) the 2nd smallest element is 3. In the second subarray of size 3 ([1,4,2]) the 2nd smallest element is 2.