Tap here to switch tabs
Problem
Submissions

Problem: Non-negative Integers without Consecutive Ones

med
30 min
Try to solve the Non-negative Integers without Consecutive Ones problem.

Statement

Given a positive integer n, return the count of non negative integers in the range [0,n][0, n] whose binary representations do not contain consecutive 11s.

Constraints:

  • 1≤1 \leq n ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Non-negative Integers without Consecutive Ones

med
30 min
Try to solve the Non-negative Integers without Consecutive Ones problem.

Statement

Given a positive integer n, return the count of non negative integers in the range [0,n][0, n] whose binary representations do not contain consecutive 11s.

Constraints:

  • 1≤1 \leq n ≤109\leq 10^9