Skip to content

Commit 148aea6

Browse files
committed
add some jz_offer problems
1 parent f3d012c commit 148aea6

File tree

176 files changed

+3846
-4704
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+3846
-4704
lines changed

assets/output/0007.md

Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,100 +6,68 @@
66

77
Given a signed 32-bit integer `x`, return `x` _with its digits reversed_. If
88
reversing `x` causes the value to go outside the signed 32-bit integer range
9-
`[-231, 231 - 1]`, then return `0`.
9+
`-[2^31, 2^31 - 1]`, then return `0`.
1010

1111
**Assume the environment does not allow you to store 64-bit integers (signed
1212
or unsigned).**
1313

14-
15-
1614
**Example 1:**
1715

1816
> Input: x = 123
19-
>
17+
>
2018
> Output: 321
2119
2220
**Example 2:**
2321

2422
> Input: x = -123
25-
>
23+
>
2624
> Output: -321
2725
2826
**Example 3:**
2927

3028
> Input: x = 120
31-
>
29+
>
3230
> Output: 21
3331
3432
**Constraints:**
3533

36-
* `-231 <= x <= 231 - 1`
37-
34+
- `-2^31 <= x <= 2^31 - 1`
3835

3936
## 题目大意
4037

4138
给你一个 32 位的有符号整数 `x` ,返回将 `x` 中的数字部分反转后的结果。
4239

43-
如果反转后整数超过 32 位的有符号整数的范围 `[−231, 231 − 1]` ,就返回 0。
40+
如果反转后整数超过 32 位的有符号整数的范围 `[−231, 2^31 − 1]` ,就返回 0。
4441

4542
**假设环境不允许存储 64 位整数(有符号或无符号)。**
4643

4744
**示例 1:**
4845

49-
>
50-
>
51-
>
52-
>
53-
>
5446
> **输入:** x = 123
55-
>
47+
>
5648
> **输出:** 321
57-
>
58-
>
5949
6050
**示例 2:**
6151

62-
>
63-
>
64-
>
65-
>
66-
>
6752
> **输入:** x = -123
68-
>
53+
>
6954
> **输出:** -321
70-
>
71-
>
7255
7356
**示例 3:**
7457

75-
>
76-
>
77-
>
78-
>
79-
>
8058
> **输入:** x = 120
81-
>
59+
>
8260
> **输出:** 21
83-
>
84-
>
8561
8662
**示例 4:**
8763

88-
>
89-
>
90-
>
91-
>
92-
>
9364
> **输入:** x = 0
94-
>
65+
>
9566
> **输出:** 0
96-
>
97-
>
9867
9968
**提示:**
10069

101-
* `-231 <= x <= 231 - 1`
102-
70+
- `-2^31 <= x <= 2^31 - 1`
10371

10472
## 解题思路
10573

@@ -122,4 +90,4 @@ or unsigned).**
12290
| 8 | [字符串转换整数 (atoi)](https://leetcode.com/problems/string-to-integer-atoi) | [[]](/problem/0008.md) | [`字符串`](/tag/string.md) | <font color=#ffb800>Medium</font> |
12391
| 190 | [颠倒二进制位](https://leetcode.com/problems/reverse-bits) | [[]](/problem/0190.md) | [`位运算`](/tag/bit-manipulation.md) [`分治`](/tag/divide-and-conquer.md) | <font color=#15bd66>Easy</font> |
12492
| 2119 | [反转两次的数字](https://leetcode.com/problems/a-number-after-a-double-reversal) | | [`数学`](/tag/math.md) | <font color=#15bd66>Easy</font> |
125-
| 2442 | [反转之后不同整数的数目](https://leetcode.com/problems/count-number-of-distinct-integers-after-reverse-operations) | | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) [`数学`](/tag/math.md) `1+` | <font color=#ffb800>Medium</font> |
93+
| 2442 | [反转之后不同整数的数目](https://leetcode.com/problems/count-number-of-distinct-integers-after-reverse-operations) | | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) [`数学`](/tag/math.md) `1+` | <font color=#ffb800>Medium</font> |

0 commit comments

Comments
 (0)