Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ This table contains the ID of the user who sent the request, the ID of the user
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong>
<strong>Input:</strong>
RequestAccepted table:
+--------------+-------------+-------------+
| requester_id | accepter_id | accept_date |
Expand All @@ -52,13 +52,13 @@ RequestAccepted table:
| 2 | 3 | 2016/06/08 |
| 3 | 4 | 2016/06/09 |
+--------------+-------------+-------------+
<strong>Output:</strong>
<strong>Output:</strong>
+----+-----+
| id | num |
+----+-----+
| 3 | 3 |
+----+-----+
<strong>Explanation:</strong>
<strong>Explanation:</strong>
The person with id 3 is a friend of people 1, 2, and 4, so he has three friends in total, which is the most number than any others.
</pre>

Expand Down
6 changes: 3 additions & 3 deletions solution/0600-0699/0630.Course Schedule III/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ tags:
<pre>
<strong>Input:</strong> courses = [[100,200],[200,1300],[1000,1250],[2000,3200]]
<strong>Output:</strong> 3
Explanation:
Explanation:
There are totally 4 courses, but you can take 3 courses at most:
First, take the 1<sup>st</sup> course, it costs 100 days so you will finish it on the 100<sup>th</sup> day, and ready to take the next course on the 101<sup>st</sup> day.
Second, take the 3<sup>rd</sup> course, it costs 1000 days so you will finish it on the 1100<sup>th</sup> day, and ready to take the next course on the 1101<sup>st</sup> day.
Third, take the 2<sup>nd</sup> course, it costs 200 days so you will finish it on the 1300<sup>th</sup> day.
Second, take the 3<sup>rd</sup> course, it costs 1000 days so you will finish it on the 1100<sup>th</sup> day, and ready to take the next course on the 1101<sup>st</sup> day.
Third, take the 2<sup>nd</sup> course, it costs 200 days so you will finish it on the 1300<sup>th</sup> day.
The 4<sup>th</sup> course cannot be taken now, since you will finish it on the 3300<sup>th</sup> day, which exceeds the closed date.
</pre>

Expand Down
9 changes: 5 additions & 4 deletions solution/0600-0699/0647.Palindromic Substrings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,15 +313,16 @@ func countSubstrings(s string) int {

```ts
function countSubstrings(s: string): number {
let t = "^#";
let t = '^#';
for (const c of s) {
t += c + "#";
t += c + '#';
}
t += "$";
t += '$';

const n = t.length;
const p: number[] = new Array(n).fill(0);
let pos = 0, maxRight = 0;
let pos = 0,
maxRight = 0;
let ans = 0;

for (let i = 1; i < n - 1; i++) {
Expand Down
9 changes: 5 additions & 4 deletions solution/0600-0699/0647.Palindromic Substrings/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,15 +312,16 @@ func countSubstrings(s string) int {

```ts
function countSubstrings(s: string): number {
let t = "^#";
let t = '^#';
for (const c of s) {
t += c + "#";
t += c + '#';
}
t += "$";
t += '$';

const n = t.length;
const p: number[] = new Array(n).fill(0);
let pos = 0, maxRight = 0;
let pos = 0,
maxRight = 0;
let ans = 0;

for (let i = 1; i < n - 1; i++) {
Expand Down
9 changes: 5 additions & 4 deletions solution/0600-0699/0647.Palindromic Substrings/Solution2.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
function countSubstrings(s: string): number {
let t = "^#";
let t = '^#';
for (const c of s) {
t += c + "#";
t += c + '#';
}
t += "$";
t += '$';

const n = t.length;
const p: number[] = new Array(n).fill(0);
let pos = 0, maxRight = 0;
let pos = 0,
maxRight = 0;
let ans = 0;

for (let i = 1; i < n - 1; i++) {
Expand Down
4 changes: 2 additions & 2 deletions solution/0600-0699/0648.Replace Words/Solution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function replaceWords(dictionary: string[], sentence: string): string {
}

return sentence
.split(" ")
.split(' ')
.map(w => trie.search(w))
.join(" ");
.join(' ');
}
2 changes: 1 addition & 1 deletion solution/0800-0899/0877.Stone Game/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ tags:
<pre>
<strong>Input:</strong> piles = [5,3,4,5]
<strong>Output:</strong> true
<strong>Explanation:</strong>
<strong>Explanation:</strong>
Alice starts first, and can only take the first 5 or the last 5.
Say she takes the first 5, so that the row becomes [3, 4, 5].
If Bob takes 3, then the board is [4, 5], and Alice takes 5 to win with 10 points.
Expand Down
2 changes: 1 addition & 1 deletion solution/2500-2599/2573.Find the String with LCP/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ tags:
<pre>
<strong>输入:</strong>lcp = [[4,3,2,1],[3,3,2,1],[2,2,2,1],[1,1,1,1]]
<strong>输出:</strong>"aaaa"
<strong>解释:</strong>lcp 对应只有一个不同字母的任意 4 字母字符串,字典序最小的是 "aaaa" 。
<strong>解释:</strong>lcp 对应只有一个不同字母的任意 4 字母字符串,字典序最小的是 "aaaa" 。
</pre>

<p><strong>示例 3:</strong></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ tags:
<pre>
<strong>Input:</strong> lcp = [[4,3,2,1],[3,3,2,1],[2,2,2,1],[1,1,1,1]]
<strong>Output:</strong> &quot;aaaa&quot;
<strong>Explanation:</strong> lcp corresponds to any 4 letter string with a single distinct letter. The lexicographically smallest of them is &quot;aaaa&quot;.
<strong>Explanation:</strong> lcp corresponds to any 4 letter string with a single distinct letter. The lexicographically smallest of them is &quot;aaaa&quot;.
</pre>

<p><strong class="example">Example 3:</strong></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ function leftRightDifference(nums: number[]): number[] {
l += x;
}
return ans;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ tags:
<strong>Explanation:</strong> There are 2 beautiful substrings in the given string.
- Substring &quot;b<u>aeyh</u>&quot;, vowels = 2 ([&quot;a&quot;,e&quot;]), consonants = 2 ([&quot;y&quot;,&quot;h&quot;]).
You can see that string &quot;aeyh&quot; is beautiful as vowels == consonants and vowels * consonants % k == 0.
- Substring &quot;<u>baey</u>h&quot;, vowels = 2 ([&quot;a&quot;,e&quot;]), consonants = 2 ([&quot;b&quot;,&quot;y&quot;]).
- Substring &quot;<u>baey</u>h&quot;, vowels = 2 ([&quot;a&quot;,e&quot;]), consonants = 2 ([&quot;b&quot;,&quot;y&quot;]).
You can see that string &quot;baey&quot; is beautiful as vowels == consonants and vowels * consonants % k == 0.
It can be shown that there are only 2 beautiful substrings in the given string.
</pre>
Expand All @@ -62,7 +62,7 @@ It can be shown that there are only 2 beautiful substrings in the given string.
<strong>Input:</strong> s = &quot;abba&quot;, k = 1
<strong>Output:</strong> 3
<strong>Explanation:</strong> There are 3 beautiful substrings in the given string.
- Substring &quot;<u>ab</u>ba&quot;, vowels = 1 ([&quot;a&quot;]), consonants = 1 ([&quot;b&quot;]).
- Substring &quot;<u>ab</u>ba&quot;, vowels = 1 ([&quot;a&quot;]), consonants = 1 ([&quot;b&quot;]).
- Substring &quot;ab<u>ba</u>&quot;, vowels = 1 ([&quot;a&quot;]), consonants = 1 ([&quot;b&quot;]).
- Substring &quot;<u>abba</u>&quot;, vowels = 2 ([&quot;a&quot;,&quot;a&quot;]), consonants = 2 ([&quot;b&quot;,&quot;b&quot;]).
It can be shown that there are only 3 beautiful substrings in the given string.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: 简单
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3800-3899/3875.Construct%20Uniform%20Parity%20Array%20I/README.md
rating: 1199
source: 第 494 场周赛 Q1
tags:
- 数组
- 数学
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Easy
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3800-3899/3875.Construct%20Uniform%20Parity%20Array%20I/README_EN.md
rating: 1199
source: Weekly Contest 494 Q1
tags:
- Array
- Math
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3800-3899/3876.Construct%20Uniform%20Parity%20Array%20II/README.md
rating: 1443
source: 第 494 场周赛 Q2
tags:
- 数组
- 数学
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3800-3899/3876.Construct%20Uniform%20Parity%20Array%20II/README_EN.md
rating: 1443
source: Weekly Contest 494 Q2
tags:
- Array
- Math
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3800-3899/3877.Minimum%20Removals%20to%20Achieve%20Target%20XOR/README.md
rating: 1745
source: 第 494 场周赛 Q3
tags:
- 位运算
- 数组
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3800-3899/3877.Minimum%20Removals%20to%20Achieve%20Target%20XOR/README_EN.md
rating: 1745
source: Weekly Contest 494 Q3
tags:
- Bit Manipulation
- Array
Expand Down
2 changes: 2 additions & 0 deletions solution/3800-3899/3878.Count Good Subarrays/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3800-3899/3878.Count%20Good%20Subarrays/README.md
rating: 2230
source: 第 494 场周赛 Q4
tags:
- 栈
- 位运算
Expand Down
2 changes: 2 additions & 0 deletions solution/3800-3899/3878.Count Good Subarrays/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3800-3899/3878.Count%20Good%20Subarrays/README_EN.md
rating: 2230
source: Weekly Contest 494 Q4
tags:
- Stack
- Bit Manipulation
Expand Down
Loading
Loading