You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/java/com/fishercoder/solutions/_600.java
-20Lines changed: 0 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,5 @@
1
1
packagecom.fishercoder.solutions;
2
2
3
-
/**
4
-
* 600. Non-negative Integers without Consecutive Ones
5
-
*
6
-
* Given a positive integer n, find the number of non-negative integers less than or equal to n, whose binary representations do NOT contain consecutive ones.
7
-
8
-
Example 1:
9
-
Input: 5
10
-
Output: 5
11
-
Explanation:
12
-
Here are the non-negative integers <= 5 with their corresponding binary representations:
13
-
0 : 0
14
-
1 : 1
15
-
2 : 10
16
-
3 : 11
17
-
4 : 100
18
-
5 : 101
19
-
Among them, only integer 3 disobeys the rule (two consecutive ones) and the other 5 satisfy the rule.
0 commit comments