Leetcode
Leetcode <Binary Search> 668. Kth Smallest Number in Multiplication Table 44.8% Hard
tiit
2020. 4. 11. 11:16
반응형
Nearly every one have used the Multiplication Table. But could you find out the k-th smallest number quickly from the multiplication table?
Given the height m and the length n of a m * n Multiplication Table, and a positive integer k, you need to return the k-th smallest number in this table.
k번째 작은 수를 구해야한다.
m 높이 , n 넓이
Example 1:
Input: m = 3, n = 3, k = 5
Output:
Explanation:
The Multiplication Table:
1 2 3
2 4 6
3 6 9
The 5-th smallest number is 3 (1, 2, 2, 3, 3).
테이블에 있는 값을 한 배열에 넣어주고 5번째 값 구하면 되지 않을까? -- 안됨 최대갯수 30,000 * 30,000 임
반응형