202. 快乐数
func isHappy(n int) bool {slow, fast := n, next(n)for fast != 1 && fast != slow {slow = next(slow)fast = next(next(fast)) // 1的各位平方和还是1, 所以不会跳过}return fast == 1}func next(n int) int {sum := 0for n > 0 {sum += (n % 10) * (n % 10)n /= 10}return sum}
