All Posts

Leetcode 2343: Query Kth Smallest Trimmed Number

You are given a list nums where each string contains digits of the same length. Additionally, you are provided a list of queries, where each query is represented by two integers [ki, trimi]. For each query, trim each number in nums to its rightmost trimi digits, then find the index of the kith smallest trimmed number. If two numbers are identical after trimming, the one with the lower index is considered smaller. Reset the numbers in nums for the next query.