Solved LeetCode program · 274 of 1,000
#0378 · Kth Smallest Element in a Sorted Matrix
Original English source
Keep a shared numbers holding 1, 5, 9, 10, 11, 13, 12, 13, and 15. Keep a shared chosen of 0.
To seek from spot (a whole number) with best (a whole number). If spot is more than 8, set chosen to best, return. If item spot of numbers is less than item best of numbers, set best to spot. Seek from spot plus 1 with best.
For every position from 0 to 8.
Seek from position with position. swap item position of numbers and item chosen of numbers.
Show item 7 of numbers.
Expected stdout
13