go: add «650. 2 Keys Keyboard»

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2024-08-19 12:01:36 +02:00
parent 970869babd
commit 5632842740
Signed by: mfocko
SSH key fingerprint: SHA256:icm0fIOSJUpy5+1x23sfr+hLtF9UhY8VpMC7H4WFJP8

14
go/2-keys-keyboard.go Normal file
View file

@ -0,0 +1,14 @@
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
}