668. Kth Smallest Number in Multiplication Table Hard
1/**
2 * [668] Kth Smallest Number in Multiplication Table
3 *
4 * Nearly everyone has used the <a href="https://en.wikipedia.org/wiki/Multiplication_table" target="_blank">Multiplication Table</a>. The multiplication table of size m x n is an integer matrix mat where mat[i][j] == i * j (1-indexed).
5 * Given three integers m, n, and k, return the k^th smallest element in the m x n multiplication table.
6 *
7 * Example 1:
8 * <img alt="" src="https://assets.leetcode.com/uploads/2021/05/02/multtable1-grid.jpg" style="width: 500px; height: 254px;" />
9 * Input: m = 3, n = 3, k = 5
10 * Output: 3
11 * Explanation: The 5^th smallest number is 3.
12 *
13 * Example 2:
14 * <img alt="" src="https://assets.leetcode.com/uploads/2021/05/02/multtable2-grid.jpg" style="width: 493px; height: 293px;" />
15 * Input: m = 2, n = 3, k = 6
16 * Output: 6
17 * Explanation: The 6^th smallest number is 6.
18 *
19 *
20 * Constraints:
21 *
22 * 1 <= m, n <= 3 * 10^4
23 * 1 <= k <= m * n
24 *
25 */
26pub struct Solution {}
27
28// problem: https://leetcode.com/problems/kth-smallest-number-in-multiplication-table/
29// discuss: https://leetcode.com/problems/kth-smallest-number-in-multiplication-table/discuss/?currentPage=1&orderBy=most_votes&query=
30
31// submission codes start here
32
33impl Solution {
34 pub fn find_kth_number(m: i32, n: i32, k: i32) -> i32 {
35 0
36 }
37}
38
39// submission codes end
40
41#[cfg(test)]
42mod tests {
43 use super::*;
44
45 #[test]
46 fn test_668() {
47 }
48}
49
Back
© 2025 bowen.ge All Rights Reserved.