Count Fancy Numbers

Asked at Hudson River Trading · Coding Questions · Difficulty: Medium

A number is **fancy** if, when written in **base-4**, it contains only the digits `0` and `1`. For example `17` is fancy because its base-4 form is `101` (only 0s and 1s), while `18` is not, because its base-4 form is `102` (contains a forbidden `2`).

Loading the problem…