LeetCode/go/2-keys-keyboard.go
Matej Focko 5632842740
go: add «650. 2 Keys Keyboard»
Signed-off-by: Matej Focko <me@mfocko.xyz>
2024-08-19 12:01:36 +02:00

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
}