Monday, May 4, 2020

Number Complement

Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.
Example 1:
Input: 5
Output: 2
Example 2:
Input: 1
Output: 0
Solution:

No comments:

Post a Comment

Check If It Is a Straight Line

You are given an array  coordinates ,  coordinates[i] = [x, y] , where  [x, y]  represents the coordinate of a point. Check if these points ...