Apply the first step of ladder at which every tile fits, and return its position. If none fits, the last step stays applied — it is the one that loses the least of the title — and the return is ladder.length - 1.
ladder
ladder.length - 1
Apply the first step of
ladderat which every tile fits, and return its position. If none fits, the last step stays applied — it is the one that loses the least of the title — and the return isladder.length - 1.