umdreamer / leetcodeproblems

Solutions for LeetCode OJ
3 stars 9 forks source link

2023.05.27 Problem: 202. Happy Number #24

Closed umdreamer closed 1 year ago

umdreamer commented 1 year ago
  1. Happy Number Problem Link

Write an algorithm to determine if a number n is happy.

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. 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. Return true if n is a happy number, and false if not.

Example 1:

Input: n = 19
Output: true
Explanation:
12 + 92 = 82
82 + 22 = 68
62 + 82 = 100
12 + 02 + 02 = 1

Example 2:

Input: n = 2
Output: false

Constraints:

zhjingyan commented 1 year ago

屏幕截图 2023-05-27 151939

foxbou commented 1 year ago
image
Lggg1234 commented 1 year ago

屏幕截图 2023-05-27 160538

daowuwu commented 1 year ago

AE49@81 3F0`ZIT(B%CTYCO

sjh397 commented 1 year ago

image

promisewith7 commented 1 year ago

image

PinkyLame commented 1 year ago

image

tangyexi commented 1 year ago
屏幕截图 2023-05-27 171525
bedauern commented 1 year ago
Snipaste_2023-05-27_17-15-39
liu-si-han commented 1 year ago
image
huangyumei1 commented 1 year ago

QQ图片20230527172824

mafanjia commented 1 year ago

截屏15

wangshiqi7 commented 1 year ago
截屏2023-05-27 18 19 55
gusuning commented 1 year ago
屏幕截图 2023-05-27 191942
syr2212061031 commented 1 year ago

1@P9_ZR@YTX$MXH{FB)~}81

ZWJ2212061008 commented 1 year ago

image

1125766961 commented 1 year ago

image

zxm-1235 commented 1 year ago

image

yeyuxq commented 1 year ago

image

liuhuanyu6 commented 1 year ago

image

xiaolu2002 commented 1 year ago

image

123lrb commented 1 year ago

MU@`VD2X8D O8{I~ZAEQC`D

686xiaozhang commented 1 year ago

QQ截图20230527213621

FXL1006 commented 1 year ago
image
24zlx commented 1 year ago

联想截图_20230527165945

naqianqpg commented 1 year ago

8%8Y6ULLOXX $G4S `{3TFE

htywan commented 1 year ago

111

zyhzxy99 commented 1 year ago

C48KQ9C~$@)(DK_MBAK1G5C

12baoxingyu-6 commented 1 year ago
image
shylieisme commented 1 year ago

8T1`RN{FFFZR9@DSQYA43OW

zangfushuo commented 1 year ago
截屏2023-05-27 22 36 35
xkqwww commented 1 year ago

无标题

cuixiao02 commented 1 year ago

IMG_2112