Skip to content

Commit e25ef9d

Browse files
refactor 668
1 parent 2ea40e7 commit e25ef9d

File tree

1 file changed

+3
-37
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+3
-37
lines changed

src/main/java/com/fishercoder/solutions/_668.java

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,6 @@
22

33
import java.util.PriorityQueue;
44

5-
/**
6-
* 668. Kth Smallest Number in Multiplication Table
7-
*
8-
* Nearly every one have used the Multiplication Table.
9-
* But could you find out the k-th smallest number quickly from the multiplication table?
10-
* Given the height m and the length n of a m * n Multiplication Table,
11-
* and a positive integer k, you need to return the k-th smallest number in this table.
12-
13-
Example 1:
14-
Input: m = 3, n = 3, k = 5
15-
Output:
16-
Explanation:
17-
The Multiplication Table:
18-
1 2 3
19-
2 4 6
20-
3 6 9
21-
22-
The 5-th smallest number is 3 (1, 2, 2, 3, 3).
23-
24-
25-
Example 2:
26-
Input: m = 2, n = 3, k = 6
27-
Output:
28-
Explanation:
29-
The Multiplication Table:
30-
1 2 3
31-
2 4 6
32-
33-
The 6-th smallest number is 6 (1, 2, 2, 3, 4, 6).
34-
35-
Note:
36-
37-
The m and n will be in the range [1, 30000].
38-
The k will be in the range [1, m * n]
39-
*/
40-
415
public class _668 {
426
public static class Solution1 {
437
/**
@@ -65,7 +29,9 @@ public int findKthNumber(int m, int n, int k) {
6529
}
6630

6731
public static class Solution2 {
68-
/**reference: https://discuss.leetcode.com/topic/101132/java-solution-binary-search*/
32+
/**
33+
* reference: https://discuss.leetcode.com/topic/101132/java-solution-binary-search
34+
*/
6935
public int findKthNumber(int m, int n, int k) {
7036
int low = 1;
7137
int high = m * n + 1;

0 commit comments

Comments
 (0)