CT103

Double-Base Palindromes

EasyAcceptance: 0.0%

The decimal number 585 = 1001001001 in binary is palindromic in both bases. Given n, find the sum of all numbers below n that are palindromic in both base 10 and base 2. (Single-digit numbers are palindromic.)

Example 1:

Input: 10
Output: 25

Example 2:

Input: 1000000
Output: 872187

Example 3:

Input: 1000
Output: 1772

Constraints:

1 <= n <= 10^6

Tags:

math palindrome binary
Loading...
Test Cases:No test cases
No test cases available.
Coding Problem Not Found | CodeTikki