Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- def findKthNumber(self, m: int, n: int, k: int) -> int:
- h = [(i, i) for i in range(1, m+1)]
- heapq.heapify(h)
- while k:
- val, i = heapq.heappop(h)
- if val // i < n:
- heapq.heappush(h, ((val // i + 1) * i, i))
- k -= 1
- return val
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement