harbor run -t openthoughts/tasktrove-mix-h10-reward-binary-v2-mix-h10-binary-0745
harbor download openthoughts/tasktrove-mix-h10-reward-binary-v2-mix-h10-binary-0745
Implement a function that computes the bitwise complement of a given non-negative integer.
You need to implement the following function according to the provided signature:
def bitwise_complement(N: int) -> int:
N
The bitwise complement of an integer N is obtained by flipping all the bits in its binary representation. For example:
5
101
010
2
assert bitwise_complement(5) == 2 assert bitwise_complement(7) == 0 assert bitwise_complement(10) == 5
Write the implementation in a file called /app/solution.py.
/app/solution.py
Make sure to handle the input as specified and ensure that the function is efficient enough to handle the upper limits of the constraints.