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

Appearance settings

Commit 156a16b

Browse filesBrowse files
committed
add 22 solutions
1 parent 1893233 commit 156a16b
Copy full SHA for 156a16b

File tree

Expand file treeCollapse file tree

174 files changed

+5363
-3987
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

174 files changed

+5363
-3987
lines changed

‎assets/output/0007.md

Copy file name to clipboardExpand all lines: assets/output/0007.md
+10-42Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,27 @@ reversing `x` causes the value to go outside the signed 32-bit integer range
2323
**Assume the environment does not allow you to store 64-bit integers (signed
2424
or unsigned).**
2525

26-
27-
2826
**Example 1:**
2927

3028
> Input: x = 123
31-
>
29+
>
3230
> Output: 321
3331
3432
**Example 2:**
3533

3634
> Input: x = -123
37-
>
35+
>
3836
> Output: -321
3937
4038
**Example 3:**
4139

4240
> Input: x = 120
43-
>
41+
>
4442
> Output: 21
4543
4644
**Constraints:**
4745

48-
* `-231 <= x <= 231 - 1`
49-
46+
- `-2^31 <= x <= 2^31 - 1`
5047

5148
## 题目大意
5249

@@ -58,60 +55,31 @@ or unsigned).**
5855

5956
**示例 1:**
6057

61-
>
62-
>
63-
>
64-
>
65-
>
6658
> **输入:** x = 123
67-
>
59+
>
6860
> **输出:** 321
69-
>
70-
>
7161
7262
**示例 2:**
7363

74-
>
75-
>
76-
>
77-
>
78-
>
7964
> **输入:** x = -123
80-
>
65+
>
8166
> **输出:** -321
82-
>
83-
>
8467
8568
**示例 3:**
8669

87-
>
88-
>
89-
>
90-
>
91-
>
9270
> **输入:** x = 120
93-
>
71+
>
9472
> **输出:** 21
95-
>
96-
>
9773
9874
**示例 4:**
9975

100-
>
101-
>
102-
>
103-
>
104-
>
10576
> **输入:** x = 0
106-
>
77+
>
10778
> **输出:** 0
108-
>
109-
>
11079
11180
**提示:**
11281

113-
* `-231 <= x <= 231 - 1`
114-
82+
- `-2^31 <= x <= 2^31 - 1`
11583

11684
## 解题思路
11785

@@ -134,4 +102,4 @@ or unsigned).**
134102
| 8 | 字符串转换整数 (atoi) | [[]](/problem/0008.md) | [`字符串`](/tag/string.md) | 🟠 | [🀄️](https://leetcode.cn/problems/string-to-integer-atoi) [🔗](https://leetcode.com/problems/string-to-integer-atoi) |
135103
| 190 | 颠倒二进制位 | [[]](/problem/0190.md) | [`位运算`](/tag/bit-manipulation.md) [`分治`](/tag/divide-and-conquer.md) | 🟢 | [🀄️](https://leetcode.cn/problems/reverse-bits) [🔗](https://leetcode.com/problems/reverse-bits) |
136104
| 2119 | 反转两次的数字 | | [`数学`](/tag/math.md) | 🟢 | [🀄️](https://leetcode.cn/problems/a-number-after-a-double-reversal) [🔗](https://leetcode.com/problems/a-number-after-a-double-reversal) |
137-
| 2442 | 反转之后不同整数的数目 | | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) [`数学`](/tag/math.md) `1+` | 🟠 | [🀄️](https://leetcode.cn/problems/count-number-of-distinct-integers-after-reverse-operations) [🔗](https://leetcode.com/problems/count-number-of-distinct-integers-after-reverse-operations) |
105+
| 2442 | 反转之后不同整数的数目 | | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) [`数学`](/tag/math.md) `1+` | 🟠 | [🀄️](https://leetcode.cn/problems/count-number-of-distinct-integers-after-reverse-operations) [🔗](https://leetcode.com/problems/count-number-of-distinct-integers-after-reverse-operations) |

‎assets/output/0009.md

Copy file name to clipboardExpand all lines: assets/output/0009.md
+16-49Lines changed: 16 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,105 +19,72 @@ keywords:
1919
Given an integer `x`, return `true` _if_`x` _is a_ _**palindrome**_ _,
2020
and_`false` _otherwise_.
2121

22-
23-
2422
**Example 1:**
2523

2624
> Input: x = 121
27-
>
25+
>
2826
> Output: true
29-
>
27+
>
3028
> Explanation: 121 reads as 121 from left to right and from right to left.
3129
3230
**Example 2:**
3331

3432
> Input: x = -121
35-
>
33+
>
3634
> Output: false
37-
>
35+
>
3836
> Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.
3937
4038
**Example 3:**
4139

4240
> Input: x = 10
43-
>
41+
>
4442
> Output: false
45-
>
43+
>
4644
> Explanation: Reads 01 from right to left. Therefore it is not a palindrome.
4745
4846
**Constraints:**
4947

50-
* `-231 <= x <= 231 - 1`
51-
52-
48+
- `-2^31 <= x <= 2^31 - 1`
5349

5450
**Follow up:** Could you solve it without converting the integer to a string?
5551

56-
5752
## 题目大意
5853

5954
给你一个整数 `x` ,如果 `x` 是一个回文整数,返回 `true` ;否则,返回 `false`
6055

6156
回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。
6257

63-
* 例如,`121` 是回文,而 `123` 不是。
64-
65-
58+
- 例如,`121` 是回文,而 `123` 不是。
6659

6760
**示例 1:**
6861

69-
>
70-
>
71-
>
72-
>
73-
>
7462
> **输入:** x = 121
75-
>
63+
>
7664
> **输出:** true
77-
>
78-
>
7965
80-
**示例 2:**
66+
**示例 2:**
8167

82-
>
83-
>
84-
>
85-
>
86-
>
8768
> **输入:** x = -121
88-
>
69+
>
8970
> **输出:** false
90-
>
71+
>
9172
> **解释:** 从左向右读, 为 -121 。 从右向左读, 为 121- 。因此它不是一个回文数。
92-
>
93-
>
9473
9574
**示例 3:**
9675

97-
>
98-
>
99-
>
100-
>
101-
>
10276
> **输入:** x = 10
103-
>
77+
>
10478
> **输出:** false
105-
>
79+
>
10680
> **解释:** 从右向左读, 为 01 。因此它不是一个回文数。
107-
>
108-
>
109-
110-
11181
11282
**提示:**
11383

114-
* `-231 <= x <= 231 - 1`
115-
116-
84+
- `-2^31 <= x <= 2^31 - 1`
11785

11886
**进阶:** 你能不将整数转为字符串来解决这个问题吗?
11987

120-
12188
## 解题思路
12289

12390
#### 复杂度分析
@@ -141,4 +108,4 @@ and_`false` _otherwise_.
141108
| 2396 | 严格回文的数字 | | [`脑筋急转弯`](/tag/brainteaser.md) [`数学`](/tag/math.md) [`双指针`](/tag/two-pointers.md) | 🟠 | [🀄️](https://leetcode.cn/problems/strictly-palindromic-number) [🔗](https://leetcode.com/problems/strictly-palindromic-number) |
142109
| 2843 | 统计对称整数的数目 | | [`数学`](/tag/math.md) [`枚举`](/tag/enumeration.md) | 🟢 | [🀄️](https://leetcode.cn/problems/count-symmetric-integers) [🔗](https://leetcode.com/problems/count-symmetric-integers) |
143110
| 3260 | 找出最大的 N 位 K 回文数 | | [`贪心`](/tag/greedy.md) [`数学`](/tag/math.md) [`字符串`](/tag/string.md) `2+` | 🔴 | [🀄️](https://leetcode.cn/problems/find-the-largest-palindrome-divisible-by-k) [🔗](https://leetcode.com/problems/find-the-largest-palindrome-divisible-by-k) |
144-
| 3272 | 统计好整数的数目 | | [`哈希表`](/tag/hash-table.md) [`数学`](/tag/math.md) [`组合数学`](/tag/combinatorics.md) `1+` | 🔴 | [🀄️](https://leetcode.cn/problems/find-the-count-of-good-integers) [🔗](https://leetcode.com/problems/find-the-count-of-good-integers) |
111+
| 3272 | 统计好整数的数目 | | [`哈希表`](/tag/hash-table.md) [`数学`](/tag/math.md) [`组合数学`](/tag/combinatorics.md) `1+` | 🔴 | [🀄️](https://leetcode.cn/problems/find-the-count-of-good-integers) [🔗](https://leetcode.com/problems/find-the-count-of-good-integers) |

‎assets/output/0029.md

Copy file name to clipboardExpand all lines: assets/output/0029.md
+15-33Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,26 @@ this problem, if the quotient is **strictly greater than** `231 - 1`, then
3232
return `231 - 1`, and if the quotient is **strictly less than** `-231`, then
3333
return `-231`.
3434

35-
36-
3735
**Example 1:**
3836

3937
> Input: dividend = 10, divisor = 3
40-
>
38+
>
4139
> Output: 3
42-
>
40+
>
4341
> Explanation: 10/3 = 3.33333.. which is truncated to 3.
4442
4543
**Example 2:**
4644

4745
> Input: dividend = 7, divisor = -3
48-
>
46+
>
4947
> Output: -2
50-
>
48+
>
5149
> Explanation: 7/-3 = -2.33333.. which is truncated to -2.
5250
5351
**Constraints:**
5452

55-
* `-231 <= dividend, divisor <= 231 - 1`
56-
* `divisor != 0`
57-
53+
- `-2^31 <= dividend, divisor <= 2^31 - 1`
54+
- `divisor != 0`
5855

5956
## 题目大意
6057

@@ -67,41 +64,26 @@ return `-231`.
6764
**注意:** 假设我们的环境只能存储 **32 位** 有符号整数,其数值范围是 `[−231, 231 − 1]` 。本题中,如果商 **严格大于**
6865
`231 − 1` ,则返回 `231 − 1` ;如果商 **严格小于** `-231` ,则返回 `-231`
6966

67+
**示例 1:**
7068

71-
72-
**示例 1:**
73-
74-
>
75-
>
76-
>
77-
>
78-
>
7969
> **输入:** dividend = 10, divisor = 3
80-
>
70+
>
8171
> **输出:** 3
82-
>
72+
>
8373
> **解释:** 10/3 = 3.33333.. ,向零截断后得到 3 。
8474
85-
**示例 2:**
75+
**示例 2:**
8676

87-
>
88-
>
89-
>
90-
>
91-
>
9277
> **输入:** dividend = 7, divisor = -3
93-
>
78+
>
9479
> **输出:** -2
95-
>
80+
>
9681
> **解释:** 7/-3 = -2.33333.. ,向零截断后得到 -2 。
9782
98-
99-
10083
**提示:**
10184

102-
* `-231 <= dividend, divisor <= 231 - 1`
103-
* `divisor != 0`
104-
85+
- `-2^31 <= dividend, divisor <= 2^31 - 1`
86+
- `divisor != 0`
10587

10688
## 解题思路
10789

@@ -114,4 +96,4 @@ return `-231`.
11496

11597
```javascript
11698

117-
```
99+
```

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.