Problem Β· Array
Kth Smallest in Subarray π
Learn this problemProblem statement
Given an array arr, return the kth smallest integer for each subarray of size m.
Function
kthSmallestInSubarray(arr: int[], k: int, m: int) β int[]Examples
Example 1
arr = [3, 1, 4, 2]k = 2m = 3return = [3, 2]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.
More Amazon problems
- Secure Maximum DeliveriesOA Β· Seen Jul 2026
- Find Median from Data StreamONSITE INTERVIEW Β· Seen Jul 2026
- Handwritten SigmoidPHONE SCREEN Β· Seen Jul 2026
- Handwritten SoftmaxPHONE SCREEN Β· Seen Jul 2026
- Koko Eating BananasONSITE INTERVIEW Β· Seen Jul 2026
- Loyal Customers Across Two DaysONSITE INTERVIEW Β· Seen Jul 2026
- Maximum System Memory CapacityOA Β· Seen Jul 2026
- Package Delivery SystemOA Β· Seen Jul 2026