• Challenge Author
    + 1 comment

    If N is not a power of 2, then reduce the counter by the largest power of 2 less than N.

    that's why

    10 -> (10 - 8 ) = 2 -> 1