Tap here to switch tabs
Problem
Submissions

Problem: Count Binary Palindromic Numbers

Try to solve the Count Binary Palindromic Numbers problem.

Statement

Given an integer n, return the total number of integers kk in the range [0,[0, n]] such that the binary representation of kk without leading zeros is a palindrome.

Note: The binary representation of 00 is $ ext{“}0 ext{”}$.

Constraints:

  • 0≤0 \leq n ≤1015\leq 10^{15}

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Binary Palindromic Numbers

Try to solve the Count Binary Palindromic Numbers problem.

Statement

Given an integer n, return the total number of integers kk in the range [0,[0, n]] such that the binary representation of kk without leading zeros is a palindrome.

Note: The binary representation of 00 is $ ext{“}0 ext{”}$.

Constraints:

  • 0≤0 \leq n ≤1015\leq 10^{15}