The constraints do all the work: you may not modify the array and you may use only
O(1) extra space. That bans sorting, bans a seen[] set, and bans the
negative-marking trick. What is left is a reframing — read the array as a linked list where
index i points to nums[i]. Values live in [1, n], so nothing
ever points at index 0, which means the walk from 0 must eventually repeat: a
cycle. Two indices holding the same value are two nodes with the same
successor, so the duplicate is the cycle entrance. From there it is LeetCode 142 verbatim.