Contains Duplicate — sort, then check neighbors
Sorting lines equal values up side by side, so any duplicate shows up as two identical neighbors. One left-to-right scan of adjacent pairs settles it.
Try:
← Prev
Next →
▶ Play
Reset
sorted array