Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ef387d9

Browse files
Add README_EN.md for 0202.Happy Number
1 parent aba618a commit ef387d9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Happy Number
2+
3+
Write an algorithm to determine if a number is "happy".
4+
5+
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.
6+
7+
## Example :
8+
```
9+
Input: 19
10+
Output: true
11+
Explanation:
12+
12 + 92 = 82
13+
82 + 22 = 68
14+
62 + 82 = 100
15+
12 + 02 + 02 = 1
16+
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /