def find_missing_number_code_golf(arr: list[int]) -> int:
    """

    Since XOR is commutative and associative,
    use a single variable to reduce XORs


    Complexity:
        Time: O(n)
        Space: O(1)

    Returns:

    Examples:
        >>> find_missing_number_code_golf([1, 5, 2, 6, 4])
        3

    """
    """ALGORITHM"""
    ## INITIALIZE VARS ##
    n = len(arr) + 1

    # XOR of all values from n to 1 & nums in arr
    missing_number = n
    # REDUCE (n-1 iterations)
    for i, num in enumerate(arr):
        missing_number ^= (i + 1) ^ num
    return missing_number