0 out of 464 challenges solved

Check One Bit Difference

Write a Python function `differ_at_one_bit(a: int, b: int) -> bool` that checks whether two integers differ at exactly one bit position in their binary representation.

#### Function Signature
```python [main.nopy]
def differ_at_one_bit(a: int, b: int) -> bool:
    pass
```

#### Explanation
Two numbers differ at exactly one bit position if their XOR result is a power of two. A number is a power of two if it has exactly one bit set in its binary representation.

#### Example Usage
```python [main.nopy]
print(differ_at_one_bit(13, 9))  # Output: True (Binary: 1101 vs 1001)
print(differ_at_one_bit(15, 8))  # Output: False (Binary: 1111 vs 1000)
print(differ_at_one_bit(2, 4))   # Output: False (Binary: 0010 vs 0100)
print(differ_at_one_bit(2, 3))   # Output: True (Binary: 0010 vs 0011)
```

#### Constraints
- The inputs `a` and `b` are non-negative integers.
def differ_at_one_bit(a: int, b: int) -> bool:
    """
    Determine if two integers differ at exactly one bit position.

    Args:
    a (int): The first integer.
    b (int): The second integer.

    Returns:
    bool: True if they differ at exactly one bit position, False otherwise.
    """
    # Placeholder for the solution
    pass