4 kyu
Block sequence
174 of 426KenKamau
Description:
Consider the following array:
[1, 12, 123, 1234, 12345, 123456, 1234567, 12345678, 123456789, 12345678910, 1234567891011...]
If we join these blocks of numbers, we come up with an infinite sequence which starts with 112123123412345123456...
. The list is infinite.
You will be given an number (n
) and your task will be to return the element at that index in the sequence, where 1 ≤ n ≤ 10^18
. Assume the indexes start with 1
, not 0
. For example:
solve(1) = 1, because the first character in the sequence is 1. There is no index 0.
solve(2) = 1, because the second character is also 1.
solve(3) = 2, because the third character is 2.
More examples in the test cases. Good luck!
Mathematics
Fundamentals
Similar Kata:
Stats:
Created | Jan 12, 2020 |
Published | Jan 12, 2020 |
Warriors Trained | 6680 |
Total Skips | 952 |
Total Code Submissions | 5669 |
Total Times Completed | 426 |
Python Completions | 174 |
Ruby Completions | 23 |
C++ Completions | 117 |
C# Completions | 37 |
Java Completions | 65 |
Kotlin Completions | 23 |
JavaScript Completions | 21 |
Total Stars | 358 |
% of votes with a positive feedback rating | 89% of 96 |
Total "Very Satisfied" Votes | 80 |
Total "Somewhat Satisfied" Votes | 10 |
Total "Not Satisfied" Votes | 6 |
Total Rank Assessments | 4 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 8 kyu |