My LeetCode grinding. Trying to do a problem a day.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

problem.txt 516B

12345678910111213
  1. Write an algorithm to determine if a number is "happy".
  2. A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers.
  3. Example:
  4. Input: 19
  5. Output: true
  6. Explanation:
  7. 12 + 92 = 82
  8. 82 + 22 = 68
  9. 62 + 82 = 100
  10. 12 + 02 + 02 = 1