Number Complement

Easy
Math Bit Manipulation

Given a positive integer, flip all bits in its binary representation.

Constraints

1 ≤ num < 2^31

Examples

Example 1:
Input: 5
Output: 2
Explanation: 5=101→010=2
Example 2:
Input: 1
Output: 0
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.