It's solution in O(n) time and O(1) space in a much easily understandable way can be found here:
https://avrcoder.wordpress.com/2016/07/30/find-the-duplicate-number/
It's solution in O(n) time and O(1) space in a much easily understandable way can be found here:
https://avrcoder.wordpress.com/2016/07/30/find-the-duplicate-number/