Count Base-4 Numbers Containing Only 0 and 1

Given a non-negative integer n, count how many fancy numbers x satisfy 0 <= x < n.

A number is fancy if its base-4 representation contains only digits 0 and 1. The representation has no...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: