Skip to content

Commit 2141e8e

Browse files
authored
Create Solution.java
1 parent 1364317 commit 2141e8e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public int minSteps(int n) {
3+
int res = 0;
4+
for (int i = 2; n > 1; ++i) {
5+
while (n % i == 0) {
6+
res += i;
7+
n /= i;
8+
}
9+
}
10+
return res;
11+
}
12+
}

0 commit comments

Comments
 (0)