2343. Query Kth Smallest Trimmed Number

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 2343

class Solution:
    def smallestTrimmedNumbers(
        self, nums: List[str], queries: List[List[int]]
    ) -> List[int]:
        res = []
        for k, trim in queries:
            t = sorted((v[-trim:], i) for i, v in enumerate(nums))
            res.append(t[k - 1][1])
        return res