Find the Duplicate Number, seven ways

Try:
CALL
1 / 1

Code

The highlighted line runs next. The pill shows the live values in the running call.

Cost

Work done so far, and how the seven solutions compare

nums

Indices under the cells, values inside

Keyboard: ← → step, Space play or pause. 2 to 9 numbers, each between 1 and length − 1, with exactly one repeated value. The Java and C++ fast-and-slow code uses do-while loops, which behave the same as Python's while True … break.