heights. The teacher lines the class up by height, shortest first, with places numbered from zero.
Return every place that will be taken by a student whose height is exactly wanted, in increasing order. If there is no such student, return an empty list.heights=[7, 3, 7, 5, 1], wanted=7 → [3, 4]
Sorted, the list becomes [1, 3, 5, 7, 7]: the value 7 sits at positions 3 and 4.
heights=[4, 2, 9], wanted=2 → [0]
The sorted array is [2, 4, 9], and 2 comes first.
heights=[6, 6, 8], wanted=5 → []
There is no 5 in the array, so the answer is empty.
heights=[7, 3, 7, 5, 1], wanted=7
[3, 4]
Run checks the first 3 tests in your browser. Submit checks all 118 tests on the server, hidden ones included.