Didn't get the solution


I have checked the solution as i was not able to solve it in a optimized way , But can anyone help me understand the solution , as i am unable to do so .


For the Fastest version of the solution, the idea is following.
Step 1. Calculate the count of elements with prefix cur, and cur+1and values less than A
Step 2. if the value of k (the desired position) is greater than the counts (calculated in step 1), that means, there your solution doesn’t include the previous prefix. Hence, you have to increment the prefix. And your value of k will be decremented by count (as these number of elements is before the kth element). Now you have to search for the (k-count)th position with (prefix+1) prefix.
Step 3. if the value of k is less than the counts (calculated in step 1), then you know that your desired value has the current prefix. But it doesn’t equal to the desired value. That’s why you multiply this prefix with 10 (which will keep the prefix same).