Count Fancy Numbers
Problem Overview
- Count how many "fancy" numbers are less than a given n, where a number is fancy if its base-4 form uses only digits 0 and 1.
- Input: integer n (up to about 1,000,000,000); Output: the count of such numbers strictly below n.
- Domain: number systems and digit constraints; large n suggests attention to performance.
- This coding interview problem was asked in Hudson_river interviews and is a common interview question.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
