k.go 221 B

12345678910111213141516
  1. package kata
  2. func Seven(n int64) []int {
  3. steps := 0
  4. current := int(n)
  5. for {
  6. n1, n2 := current / 10, current % 10
  7. if current < 100 {
  8. break
  9. }
  10. current = n1 - 2*n2
  11. steps++
  12. }
  13. return []int{current, steps}
  14. }