Skip to content

Commit eaf14ba

Browse files
committed
style: format code and documents
1 parent 6d7cee7 commit eaf14ba

File tree

171 files changed

+20871
-20547
lines changed

Some content is hidden

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

171 files changed

+20871
-20547
lines changed

README.md

Lines changed: 284 additions & 284 deletions
Large diffs are not rendered by default.

README_EN.md

Lines changed: 268 additions & 268 deletions
Large diffs are not rendered by default.

lcci/10.01.Sorted Merge/README_EN.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ impl Solution {
107107
}
108108
```
109109

110-
111110
### **...**
112111

113112
```

lcci/10.02.Group Anagrams/README_EN.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ impl Solution {
149149
}
150150
```
151151

152-
153152
### **...**
154153

155154
```

lcci/17.04.Missing Number/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
- 排序 `nums`,检查 `nums[i] == i`,返回条件不成立的 `i`
3131
- 若全部符合条件,则返回 `nums.length`
3232
2. 数学
33-
- 遍历 `nums`,统计总和,并记录其中的最大值。
34-
- 若最大值与 `nums.length` 一致,使用高斯算法(`(n + 1) * n / 2`)计算总和,与遍历总和相减,得到结果。
35-
- 不一致,则缺失的就是 `nums.length`
33+
- 遍历 `nums`,统计总和,并记录其中的最大值。
34+
- 若最大值与 `nums.length` 一致,使用高斯算法(`(n + 1) * n / 2`)计算总和,与遍历总和相减,得到结果。
35+
- 不一致,则缺失的就是 `nums.length`
3636
3. 位运算
37-
- 利用异或的特性,`res = res ^ x ^ x`。对同一个值异或两次,结果等于它本身。最后异或的结果,就是只出现一次的数字,即数组中缺失的整数。
37+
- 利用异或的特性,`res = res ^ x ^ x`。对同一个值异或两次,结果等于它本身。最后异或的结果,就是只出现一次的数字,即数组中缺失的整数。
3838

3939
<!-- tabs:start -->
4040

lcci/17.11.Find Closest/Solution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution:
22
def findClosest(self, words: List[str], word1: str, word2: str) -> int:
3-
idx1, idx2, ans = 10**5, -10**5, 10**5
3+
idx1, idx2, ans = 10**5, -(10**5), 10**5
44
for i, word in enumerate(words):
55
if word == word1:
66
idx1 = i

lcci/17.17.Multi Search/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ private:
159159

160160
public:
161161
Trie() : children(26), idx(-1) {}
162-
162+
163163
void insert(string word, int i) {
164164
Trie* node = this;
165165
for (char c : word)
@@ -170,7 +170,7 @@ public:
170170
}
171171
node->idx = i;
172172
}
173-
173+
174174
vector<int> search(string word) {
175175
Trie* node = this;
176176
vector<int> res;

lcci/17.17.Multi Search/README_EN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ private:
156156

157157
public:
158158
Trie() : children(26), idx(-1) {}
159-
159+
160160
void insert(string word, int i) {
161161
Trie* node = this;
162162
for (char c : word)
@@ -167,7 +167,7 @@ public:
167167
}
168168
node->idx = i;
169169
}
170-
170+
171171
vector<int> search(string word) {
172172
Trie* node = this;
173173
vector<int> res;

lcof/面试题57. 和为s的两个数字/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
- 存在,即 `return` 返回。
3737
- 不存在,记录元素,继续遍历。
3838

39-
*复杂度*
39+
_复杂度_
4040

41-
- 时间 ***O(N)***
42-
- 空间 ***O(N)***
41+
- 时间 **_O(N)_**
42+
- 空间 **_O(N)_**
4343

4444
**双指针**
4545

@@ -52,10 +52,10 @@
5252

5353
> 因为数组是有序的,指针变动对值的影响可预测。
5454
55-
*复杂度*
55+
_复杂度_
5656

57-
- 时间 ***O(N)***
58-
- 空间 ***O(1)***
57+
- 时间 **_O(N)_**
58+
- 空间 **_O(1)_**
5959

6060
```txt
6161
TWO-SUM(A,t)

lcof2/剑指 Offer II 034. 外星语言是否排序/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ function isAlienSorted(words: string[], order: string): boolean {
122122
function compare(str1: string, str2: string): boolean {
123123
const n = Math.min(str1.length, str2.length);
124124
for (let i = 0; i < n; i++) {
125-
let k1 = str1[i], k2 = str2[i];
125+
let k1 = str1[i],
126+
k2 = str2[i];
126127
if (k1 != k2) return charMap.get(k1) < charMap.get(k2);
127128
}
128129
return n == str1.length;
@@ -131,7 +132,7 @@ function isAlienSorted(words: string[], order: string): boolean {
131132
if (!compare(words[i - 1], words[i])) return false;
132133
}
133134
return true;
134-
};
135+
}
135136
```
136137

137138
### **C++**

0 commit comments

Comments
 (0)