from typing import List


def find_duplicate_pointers(arr: List[int]) -> int:
    """
    Time Complexity: O(N)
    Space Complexity: O(1)

    Parameters
    ----------
    arr : List[int]
        Input unsorted array.

    Returns
    -------
    ptr1 ： int
        The duplicate number in the given array.

    """
    fast, slow = arr[arr[0]], arr[0]
    while fast != slow:
        fast = arr[arr[fast]]
        slow = arr[slow]
    curr = arr[arr[slow]]
    cycle_length = 1
    while curr != arr[slow]:
        curr = arr[curr]
        cycle_length += 1
    ptr1, ptr2 = arr[0], arr[0]
    while cycle_length > 0:
        ptr2 = arr[ptr2]
        cycle_length -= 1
    while ptr1 != ptr2:
        ptr1 = arr[ptr1]
        ptr2 = arr[ptr2]
    return ptr1