File tree Expand file tree Collapse file tree 1 file changed +0
-17
lines changed
src/main/java/com/fishercoder/solutions Expand file tree Collapse file tree 1 file changed +0
-17
lines changed Original file line number Diff line number Diff line change 1
1
package com .fishercoder .solutions ;
2
2
3
- /**
4
- * 476. Number Complement
5
- *
6
- * Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.
7
-
8
- Note:
9
- The given integer is guaranteed to fit within the range of a 32-bit signed integer.
10
- You could assume no leading zero bit in the integer’s binary representation.
11
- Example 1:
12
- Input: 5
13
- Output: 2
14
- Explanation: The binary representation of 5 is 101 (no leading zero bits), and its complement is 010. So you need to output 2.
15
- Example 2:
16
- Input: 1
17
- Output: 0
18
- Explanation: The binary representation of 1 is 1 (no leading zero bits), and its complement is 0. So you need to output 0.
19
- */
20
3
public class _476 {
21
4
22
5
public static class Solution1 {
You can’t perform that action at this time.
0 commit comments