it takes a bit more than that
there are some issues with your method:
1. starting with a[i] != i, you might find a cycle and go back to i. In this cycle, no element occurred more than once.
2. The problem asks you to find one repeated element. Not every element in a cycle is repeated. Finding the exact "entrance" to a cycle is the tricky part of the problem.
The big idea is correct though, and there is a linear time algorithm. Good luck~