Skip to content

Commit e2cfad6

Browse files
committed
Create 0343-integer-break.java
1 parent 94bbd8b commit e2cfad6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Diff for: java/0343-integer-break.java

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
public int integerBreak(int n) {
3+
if (n < 4) return n - 1;
4+
5+
int res = 1;
6+
7+
while (n > 4) {
8+
n -= 3;
9+
res *= 3;
10+
}
11+
12+
res *= n;
13+
return res;
14+
}
15+
}

0 commit comments

Comments
 (0)