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

Commitc04ffdc

Browse files
update 264
1 parent8973db1 commitc04ffdc

File tree

1 file changed

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

1 file changed

+3
-4
lines changed

‎src/main/java/com/fishercoder/solutions/firstthousand/_264.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,12 @@ public static class Solution3 {
7575
publicintnthUglyNumber(intn) {
7676
TreeSet<Long>treeSet =newTreeSet<>();
7777
treeSet.add(1L);
78-
int[]arr =newint[]{2,3,5};
7978
longcurrentUgly =0;
8079
for (inti =0;i <n;i++) {
8180
currentUgly =treeSet.pollFirst();
82-
treeSet.add(currentUgly *arr[0]);
83-
treeSet.add(currentUgly *arr[1]);
84-
treeSet.add(currentUgly *arr[2]);
81+
treeSet.add(currentUgly *2);
82+
treeSet.add(currentUgly *3);
83+
treeSet.add(currentUgly *5);
8584
}
8685
return (int)currentUgly;
8786
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp