1
0
Fork 0
mirror of https://gitlab.com/mfocko/LeetCode.git synced 2024-09-19 17:56:55 +02:00
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
}