hello I am stuck in this problem Digit Queries.I think I need to use recursion here although not quite sure how? Which algo or technique I need to study to solve this problem? Also please share similar types of problems from other ojs.Please help me with that.
simple constructive algorithms is enough to solve this
This string contains numbers, numbers contain digits.
Note: summary length of all n-digit numbers is easy to calculate.
So you firstly brute force the length(L) of number, where your digit took place.
Also this sum grows fast, so L < 18, so L-digit number fits in 64-bit numbers.
Then you have position of first L-digit number. Now it's easy to find in what L-digit number your digit is.
Then you have L-digit number and position of digit, you just output this digit of L-digit number.