6 kyu
How many pages in a book?
1,632 of 4,690alexbur
Description:
Every book has n
pages with page numbers 1
to n
. The summary
is made by adding up the number of digits of all page numbers.
Task: Given the summary
, find the number of pages n
the book has.
Example
If the input is summary=25
, then the output must be n=17
: The numbers 1 to 17 have 25 digits in total: 1234567891011121314151617
.
Be aware that you'll get enormous books having up to 100.000 pages.
All inputs will be valid.
Here's the opposite kata, which is more complex (Paginating a huge book)
Puzzles
Algorithms
Similar Kata:
Stats:
Created | Mar 13, 2022 |
Published | Mar 13, 2022 |
Warriors Trained | 9106 |
Total Skips | 219 |
Total Code Submissions | 15749 |
Total Times Completed | 4690 |
Python Completions | 1632 |
JavaScript Completions | 1937 |
Rust Completions | 88 |
Java Completions | 658 |
C++ Completions | 295 |
COBOL Completions | 4 |
C Completions | 171 |
D Completions | 4 |
Go Completions | 43 |
Total Stars | 151 |
% of votes with a positive feedback rating | 92% of 582 |
Total "Very Satisfied" Votes | 499 |
Total "Somewhat Satisfied" Votes | 72 |
Total "Not Satisfied" Votes | 11 |
Total Rank Assessments | 15 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |