Add up every digit from 1 to 999
Write out all the whole numbers from 1 to 999 and add up every single digit that appears. (So 999 contributes 9 + 9 + 9 = 27, and 10 contributes 1 + 0 = 1.)
What is the grand total? Find a way to do it without adding 999 numbers.
Show a hint
Pad every number to three digits with leading zeros: 000 to 999. Leading zeros add nothing, and now every position behaves the same way.
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
- No full solutions here. Hints and approaches only.
- Complexity, edge cases and intuition are the point.
- Interview experiences are welcome. Respect your NDAs.
Loading discussion…
Learn the concepts
The theory behind this question.
Related questions
The sum of all digits from 1 to a millionAnts on a triangleThe book that took 792 digits to numberWhen can the hands swap places and still show a real time?How many times is the digit 1 written from 1 to 1000?
All questions →