Sansa and XOR

  • + 0 comments

    Python 3

    from functools import reduce
    from operator import xor
    
    
    def sansaXor(arr: list[int]) -> int:
        return reduce(xor, arr[::2]) if len(arr) % 2 else 0