1
0
Fork 0
mirror of https://gitlab.com/mfocko/LeetCode.git synced 2024-11-10 00:09:06 +01:00
LeetCode/go/2-keys-keyboard.go

15 lines
145 B
Go
Raw Normal View History

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
}