Leetcode 668 Solution

This article provides solution to leetcode question 668 (kth-smallest-number-in-multiplication-table)

https://leetcode.com/problems/kth-smallest-number-in-multiplication-table

Solution

class Solution: def findKthNumber(self, m: int, n: int, k: int) -> int: l = 1 r = m * n
while l < r: mid = (l + r) // 2 if sum([min(n, mid // i) for i in range(1, m + 1)]) >= k: r = mid else: l = mid + 1 return l