Skip to content

Commit 5ee1d15

Browse files
refactor 1009
1 parent 195dd99 commit 5ee1d15

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

src/main/java/com/fishercoder/solutions/_1009.java

-32
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,6 @@
33
import java.util.ArrayList;
44
import java.util.List;
55

6-
/**
7-
* 1009. Complement of Base 10 Integer
8-
*
9-
* Every non-negative integer N has a binary representation.
10-
* For example, 5 can be represented as "101" in binary,
11-
* 11 as "1011" in binary, and so on.
12-
*
13-
* Note that except for N = 0, there are no leading zeroes in any binary representation.
14-
*
15-
* The complement of a binary representation is the number in binary you get when
16-
* changing every 1 to a 0 and 0 to a 1. For example, the complement of "101" in binary is "010" in binary.
17-
*
18-
* For a given number N in base-10, return the complement of it's binary representation as a base-10 integer.
19-
*
20-
* Example 1:
21-
* Input: 5
22-
* Output: 2
23-
* Explanation: 5 is "101" in binary, with complement "010" in binary, which is 2 in base-10.
24-
*
25-
* Example 2:
26-
* Input: 7
27-
* Output: 0
28-
* Explanation: 7 is "111" in binary, with complement "000" in binary, which is 0 in base-10.
29-
*
30-
* Example 3:
31-
* Input: 10
32-
* Output: 5
33-
* Explanation: 10 is "1010" in binary, with complement "0101" in binary, which is 5 in base-10.
34-
*
35-
* Note:
36-
* 0 <= N < 10^9
37-
* */
386
public class _1009 {
397
public static class Solution1 {
408
public int bitwiseComplement(int N) {

0 commit comments

Comments
 (0)