mirror of
https://gitlab.com/mfocko/LeetCode.git
synced 2024-11-09 15:59:06 +01:00
14 lines
145 B
Go
14 lines
145 B
Go
package main
|
|
|
|
func minSteps(n int) int {
|
|
steps := 0
|
|
|
|
for d := 2; n > 1; d++ {
|
|
for n%d == 0 {
|
|
steps += d
|
|
n /= d
|
|
}
|
|
}
|
|
|
|
return steps
|
|
}
|