0 out of 464 challenges solved
Write a Python function `count_odd_xor_pairs(arr)` that takes a list of integers `arr` and returns the number of unique pairs `(i, j)` (where `i < j`) such that the XOR of the two numbers is odd. #### Example Usage ```python [main.nopy] print(count_odd_xor_pairs([5, 4, 7, 2, 1])) # Output: 6 print(count_odd_xor_pairs([7, 2, 8, 1, 0, 5, 11])) # Output: 12 print(count_odd_xor_pairs([1, 2, 3])) # Output: 2 ``` #### Constraints - The input list will contain integers. - The list may have up to 10,000 elements. - The function should handle edge cases like empty lists or lists with one element.
def count_odd_xor_pairs(arr): """ Count the number of unique pairs (i, j) such that the XOR of arr[i] and arr[j] is odd. Args: arr (list): A list of integers. Returns: int: The count of pairs with an odd XOR value. """ # Placeholder for the solution pass