categoryGrokking Coding Interview2 - Fast and slow pointers5 - Find the duplicate numberOn this page5 - Find the duplicate numberProblem StatementApproch 1: Fast and slow pointers approchPythonWritten by @kondekarshubham123def find_duplicate(nums): slow, fast = 0, 0 while True: slow = nums[slow] fast = nums[nums[fast]] if slow == fast: break slow2 = 0 while slow != slow2: slow = nums[slow] slow2 = nums[slow2] return slow