Is the answer wrong?


  • 0
    X

    When input is 201, the answer is 141.
    However, if you use a brute-force method to count, you will find it should be 120.
    Is that answer wrong?


  • 1
    Z

    0~99 there 20 ones;

    100~199 there 100+20 ones;

    200~201 there 1 one.

    So the answer is 141


  • 0
    X

    Thanks for your reply!

    I thought it was counting the numbers containing 1 rather than how many "1"s.
    Thank you!


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.