Skip to content

Commit 279dc11

Browse files
authored
feat: add weekly contest 491 & biweekly contest 177 (#5057)
1 parent f06c45d commit 279dc11

56 files changed

Lines changed: 3382 additions & 15 deletions

File tree

Some content is hidden

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

solution/1400-1499/1404.Number of Steps to Reduce a Number in Binary Representation to One/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ tags:
4444
Step 1) 13 是奇数,加 1 得到 14 
4545
Step 2) 14 是偶数,除 2 得到 7
4646
Step 3) 7 是奇数,加 1 得到 8
47-
Step 4) 8 是偶数,除 2 得到 4 
47+
Step 4) 8 是偶数,除 2 得到 4 
4848
Step 5) 4 是偶数,除 2 得到 2 
49-
Step 6) 2 是偶数,除 2 得到 1 
49+
Step 6) 2 是偶数,除 2 得到 1 
5050
</pre>
5151

5252
<p><strong>示例 2:</strong></p>
@@ -55,7 +55,7 @@ Step 6) 2 是偶数,除 2 得到 1&nbsp;
5555
<strong>输入:</strong>s = "10"
5656
<strong>输出:</strong>1
5757
<strong>解释:</strong>"10" 表示十进制数 2 。
58-
Step 1) 2 是偶数,除 2 得到 1
58+
Step 1) 2 是偶数,除 2 得到 1
5959
</pre>
6060

6161
<p><strong>示例 3:</strong></p>

solution/1400-1499/1404.Number of Steps to Reduce a Number in Binary Representation to One/README_EN.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ tags:
4343
Step 1) 13 is odd, add 1 and obtain 14.&nbsp;
4444
Step 2) 14 is even, divide by 2 and obtain 7.
4545
Step 3) 7 is odd, add 1 and obtain 8.
46-
Step 4) 8 is even, divide by 2 and obtain 4.&nbsp;
46+
Step 4) 8 is even, divide by 2 and obtain 4.&nbsp;
4747
Step 5) 4 is even, divide by 2 and obtain 2.&nbsp;
48-
Step 6) 2 is even, divide by 2 and obtain 1.&nbsp;
48+
Step 6) 2 is even, divide by 2 and obtain 1.&nbsp;
4949
</pre>
5050

5151
<p><strong class="example">Example 2:</strong></p>
@@ -54,7 +54,7 @@ Step 6) 2 is even, divide by 2 and obtain 1.&nbsp;
5454
<strong>Input:</strong> s = &quot;10&quot;
5555
<strong>Output:</strong> 1
5656
<strong>Explanation:</strong> &quot;10&quot; corresponds to number 2 in their decimal representation.
57-
Step 1) 2 is even, divide by 2 and obtain 1.&nbsp;
57+
Step 1) 2 is even, divide by 2 and obtain 1.&nbsp;
5858
</pre>
5959

6060
<p><strong class="example">Example 3:</strong></p>

solution/1600-1699/1680.Concatenation of Consecutive Binary Numbers/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function concatenatedBinary(n: number): number {
132132
const mod = 1_000_000_007;
133133
let ans = 0;
134134
for (let i = 1; i <= n; i++) {
135-
ans = ((ans * (1 << (32 - Math.clz32(i)))) % mod + i) % mod;
135+
ans = (((ans * (1 << (32 - Math.clz32(i)))) % mod) + i) % mod;
136136
}
137137
return ans;
138138
}
@@ -281,7 +281,7 @@ function concatenatedBinary(n: number): number {
281281
if ((i & (i - 1)) === 0) {
282282
shift++;
283283
}
284-
ans = ((ans * (1 << shift)) % mod + i) % mod;
284+
ans = (((ans * (1 << shift)) % mod) + i) % mod;
285285
}
286286
return ans;
287287
}

solution/1600-1699/1680.Concatenation of Consecutive Binary Numbers/README_EN.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ tags:
2828
<pre>
2929
<strong>Input:</strong> n = 1
3030
<strong>Output:</strong> 1
31-
<strong>Explanation: </strong>&quot;1&quot; in binary corresponds to the decimal value 1.
31+
<strong>Explanation: </strong>&quot;1&quot; in binary corresponds to the decimal value 1.
3232
</pre>
3333

3434
<p><strong class="example">Example 2:</strong></p>
@@ -133,7 +133,7 @@ function concatenatedBinary(n: number): number {
133133
const mod = 1_000_000_007;
134134
let ans = 0;
135135
for (let i = 1; i <= n; i++) {
136-
ans = ((ans * (1 << (32 - Math.clz32(i)))) % mod + i) % mod;
136+
ans = (((ans * (1 << (32 - Math.clz32(i)))) % mod) + i) % mod;
137137
}
138138
return ans;
139139
}
@@ -282,7 +282,7 @@ function concatenatedBinary(n: number): number {
282282
if ((i & (i - 1)) === 0) {
283283
shift++;
284284
}
285-
ans = ((ans * (1 << shift)) % mod + i) % mod;
285+
ans = (((ans * (1 << shift)) % mod) + i) % mod;
286286
}
287287
return ans;
288288
}

solution/1600-1699/1680.Concatenation of Consecutive Binary Numbers/Solution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function concatenatedBinary(n: number): number {
22
const mod = 1_000_000_007;
33
let ans = 0;
44
for (let i = 1; i <= n; i++) {
5-
ans = ((ans * (1 << (32 - Math.clz32(i)))) % mod + i) % mod;
5+
ans = (((ans * (1 << (32 - Math.clz32(i)))) % mod) + i) % mod;
66
}
77
return ans;
88
}

solution/1600-1699/1680.Concatenation of Consecutive Binary Numbers/Solution2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function concatenatedBinary(n: number): number {
66
if ((i & (i - 1)) === 0) {
77
shift++;
88
}
9-
ans = ((ans * (1 << shift)) % mod + i) % mod;
9+
ans = (((ans * (1 << shift)) % mod) + i) % mod;
1010
}
1111
return ans;
1212
}

solution/3800-3899/3847.Find the Score Difference in a Game/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
comments: true
33
difficulty: 中等
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3800-3899/3847.Find%20the%20Score%20Difference%20in%20a%20Game/README.md
5+
rating: 1223
6+
source: 第 490 场周赛 Q1
57
tags:
68
- 数组
79
- 模拟

solution/3800-3899/3847.Find the Score Difference in a Game/README_EN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
comments: true
33
difficulty: Medium
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3800-3899/3847.Find%20the%20Score%20Difference%20in%20a%20Game/README_EN.md
5+
rating: 1223
6+
source: Weekly Contest 490 Q1
57
tags:
68
- Array
79
- Simulation

solution/3800-3899/3848.Check Digitorial Permutation/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
comments: true
33
difficulty: 中等
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3800-3899/3848.Check%20Digitorial%20Permutation/README.md
5+
rating: 1420
6+
source: 第 490 场周赛 Q2
57
tags:
68
- 数学
79
- 计数

solution/3800-3899/3848.Check Digitorial Permutation/README_EN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
comments: true
33
difficulty: Medium
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3800-3899/3848.Check%20Digitorial%20Permutation/README_EN.md
5+
rating: 1420
6+
source: Weekly Contest 490 Q2
57
tags:
68
- Math
79
- Counting

0 commit comments

Comments
 (0)