更新 0202.快乐数 排版格式修复

This commit is contained in:
jinbudaily
2023-07-19 14:34:27 +08:00
parent 19dfa98e4f
commit 764b3e9e51

View File

@ -28,7 +28,7 @@
6^2 + 8^2 = 100 6^2 + 8^2 = 100
1^2 + 0^2 + 0^2 = 1 1^2 + 0^2 + 0^2 = 1
# 思路 ## 思路
这道题目看上去貌似一道数学问题,其实并不是! 这道题目看上去貌似一道数学问题,其实并不是!
@ -80,10 +80,10 @@ public:
# 其他语言版本 ## 其他语言版本
### Java
Java
```java ```java
class Solution { class Solution {
public boolean isHappy(int n) { public boolean isHappy(int n) {
@ -107,8 +107,9 @@ class Solution {
} }
``` ```
Python ### Python
(版本一)使用集合 (版本一)使用集合
```python ```python
class Solution: class Solution:
def isHappy(self, n: int) -> bool: def isHappy(self, n: int) -> bool:
@ -205,7 +206,8 @@ class Solution:
seen.append(n) seen.append(n)
return True return True
``` ```
Go ### Go
```go ```go
func isHappy(n int) bool { func isHappy(n int) bool {
m := make(map[int]bool) m := make(map[int]bool)
@ -225,7 +227,7 @@ func getSum(n int) int {
} }
``` ```
javaScript: ### JavaScript:
```js ```js
var isHappy = function (n) { var isHappy = function (n) {
@ -303,7 +305,7 @@ var isHappy = function(n) {
}; };
``` ```
TypeScript: ### TypeScript:
```typescript ```typescript
function isHappy(n: number): boolean { function isHappy(n: number): boolean {
@ -322,7 +324,7 @@ function isHappy(n: number): boolean {
}; };
``` ```
Swift ### Swift
```swift ```swift
// number 每个位置上的数字的平方和 // number 每个位置上的数字的平方和
@ -355,7 +357,8 @@ func isHappy(_ n: Int) -> Bool {
} }
``` ```
PHP: ### PHP:
```php ```php
class Solution { class Solution {
/** /**
@ -386,7 +389,8 @@ class Solution {
} }
``` ```
Rust: ### Rust:
```Rust ```Rust
use std::collections::HashSet; use std::collections::HashSet;
impl Solution { impl Solution {
@ -416,7 +420,8 @@ impl Solution {
} }
``` ```
C: ### C:
```C ```C
typedef struct HashNodeTag { typedef struct HashNodeTag {
int key; /* num */ int key; /* num */
@ -473,8 +478,8 @@ object Solution {
} }
``` ```
### C#
C#
```csharp ```csharp
public class Solution { public class Solution {
private int getSum(int n) { private int getSum(int n) {
@ -500,3 +505,4 @@ public class Solution {
<a href="https://programmercarl.com/other/kstar.html" target="_blank"> <a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/> <img src="../pics/网站星球宣传海报.jpg" width="1000"/>
</a> </a>