この問題考えてみ。
https://leetcode.com/problems/find-the-duplicate-number/

O(1) space を問うような問題は AtCoder じゃ出ないやつだから。