Qm

How many times is the digit 1 written from 1 to 1000?

Write out every whole number from 1 to 1000 inclusive.

How many times does the digit 1 appear in total? (The number 111 contributes three.)

Then: how many of the numbers from 1 to 1000 contain the digit 1 at least once?

Show a hint

Count the numbers 000 to 999 position by position, then remember the number 1000 itself.

Your answer

Solving needs a free account

Answers, streaks and solutions unlock when you are signed in. Reading the question and the hint stays free.

Discussion

Sign in to join the discussion · reading is open to everyone

💡 Discussion rules

  1. No full solutions here. Hints and approaches only.
  2. Complexity, edge cases and intuition are the point.
  3. Interview experiences are welcome. Respect your NDAs.

Loading discussion…

Learn the concepts

The theory behind this question.

Related questions

The book that took 792 digits to numberThe sum of all digits from 1 to a millionHow many times is the digit 7 written from 1 to 1000?Palindromic dates in the 2020sAdd up every digit from 1 to 999
All questions →