Tap here to switch tabs
Problem
Submissions

Problem: Number of Digit One

Number of Digit One asks you to count every occurrence of the digit 1 in all non-negative integers from zero through a given integer n.

Statement

Given an integer n, return the total number of times the digit 11 appears in all non negative integers less than or equal to n.

Constraints:

  • 0≤0 \leq n ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Digit One

Number of Digit One asks you to count every occurrence of the digit 1 in all non-negative integers from zero through a given integer n.

Statement

Given an integer n, return the total number of times the digit 11 appears in all non negative integers less than or equal to n.

Constraints:

  • 0≤0 \leq n ≤109\leq 10^9