Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0cf4bfc

Browse files
authored
Create Kth Smallest Number in Multiplication Table.java
1 parent83d4fa8 commit0cf4bfc

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
classSolution {
2+
publicintfindKthNumber(intm,intn,intk) {
3+
intlow =0;
4+
inthigh =m *n;
5+
while (low <high) {
6+
intmid = (low +high) /2;
7+
intcount =0;
8+
for (inti =1;i <=m;i++) {
9+
count +=Math.min(n,mid /i);
10+
}
11+
if (count >=k) {
12+
high =mid;
13+
}else {
14+
low =mid +1;
15+
}
16+
}
17+
returnlow;
18+
}
19+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp