Problem Statement | |||||||||||||
Consider the following infinite sequence of numbers: 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, ... (number k appears exactly k times in the sequence). You are given a String n representing an integer (without leading zeros). Return the n-th number in that sequence (index will be 1-based). | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | n will represent an integer between 1 and 1018, inclusive. | ||||||||||||
- | n will have no leading zeros. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|