Skip to content

Commit 7356af4

Browse files
committed
docs: add new problem and update summary
1 parent 27c1701 commit 7356af4

File tree

7 files changed

+155
-7
lines changed

7 files changed

+155
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# [1873. ](https://leetcode-cn.com/problems/calculate-special-bonus)
2+
3+
[English Version](/solution/1800-1899/1873.Calculate%20Special%20Bonus/README_EN.md)
4+
5+
## 题目描述
6+
7+
<!-- 这里写题目描述 -->
8+
9+
None
10+
11+
## 解法
12+
13+
<!-- 这里可写通用的实现逻辑 -->
14+
15+
<!-- tabs:start -->
16+
17+
### **SQL**
18+
19+
<!-- 这里可写当前语言的特殊实现逻辑 -->
20+
21+
```sql
22+
23+
```
24+
25+
<!-- tabs:end -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# [1873. Calculate Special Bonus](https://leetcode.com/problems/calculate-special-bonus)
2+
3+
[中文文档](/solution/1800-1899/1873.Calculate%20Special%20Bonus/README.md)
4+
5+
## Description
6+
7+
<p>Table: <code>Employees</code></p>
8+
9+
10+
11+
<pre>
12+
13+
+-------------+---------+
14+
15+
| Column Name | Type |
16+
17+
+-------------+---------+
18+
19+
| employee_id | int |
20+
21+
| name | varchar |
22+
23+
| salary | int |
24+
25+
+-------------+---------+
26+
27+
employee_id is the primary key for this table.
28+
29+
Each row of this table indicates the employee ID, employee name, and salary.
30+
31+
</pre>
32+
33+
34+
35+
<p>&nbsp;</p>
36+
37+
38+
39+
<p>Write an SQL query to calculate the bonus of each employee. The bonus of an employee is <code>100%</code> of their salary if the ID of the employee is <strong>an odd number</strong> and <strong>the employee name does not start with the character </strong><code>&#39;M&#39;</code>. The bonus of an employee is <code>0</code> otherwise.</p>
40+
41+
42+
43+
<p>Return the result table ordered by <code>employee_id</code>.</p>
44+
45+
46+
47+
<p>The query result format is in the following example:</p>
48+
49+
50+
51+
<p>&nbsp;</p>
52+
53+
54+
55+
<pre>
56+
57+
Employees table:
58+
59+
+-------------+---------+--------+
60+
61+
| employee_id | name | salary |
62+
63+
+-------------+---------+--------+
64+
65+
| 2 | Meir | 3000 |
66+
67+
| 3 | Michael | 3800 |
68+
69+
| 7 | Addilyn | 7400 |
70+
71+
| 8 | Juan | 6100 |
72+
73+
| 9 | Kannon | 7700 |
74+
75+
+-------------+---------+--------+
76+
77+
78+
79+
Result table:
80+
81+
+-------------+-------+
82+
83+
| employee_id | bonus |
84+
85+
+-------------+-------+
86+
87+
| 2 | 0 |
88+
89+
| 3 | 0 |
90+
91+
| 7 | 7400 |
92+
93+
| 8 | 0 |
94+
95+
| 9 | 7700 |
96+
97+
+-------------+-------+
98+
99+
100+
101+
The employees with IDs 2 and 8 get 0 bonus because they have an even employee_id.
102+
103+
The employee with ID 3 gets 0 bonus because their name starts with &#39;M&#39;.
104+
105+
The rest of the employees get a 100% bonus.
106+
107+
</pre>
108+
109+
## Solutions
110+
111+
<!-- tabs:start -->
112+
113+
### **SQL**
114+
115+
```sql
116+
117+
```
118+
119+
<!-- tabs:end -->

solution/README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
| [0125](https://leetcode-cn.com/problems/valid-palindrome) | [验证回文串](/solution/0100-0199/0125.Valid%20Palindrome/README.md) | `双指针`,`字符串` | 简单 | |
139139
| [0126](https://leetcode-cn.com/problems/word-ladder-ii) | [单词接龙 II](/solution/0100-0199/0126.Word%20Ladder%20II/README.md) | `广度优先搜索`,`数组`,`字符串`,`回溯算法` | 困难 | |
140140
| [0127](https://leetcode-cn.com/problems/word-ladder) | [单词接龙](/solution/0100-0199/0127.Word%20Ladder/README.md) | `广度优先搜索` | 困难 | |
141-
| [0128](https://leetcode-cn.com/problems/longest-consecutive-sequence) | [最长连续序列](/solution/0100-0199/0128.Longest%20Consecutive%20Sequence/README.md) | `并查集`,`数组` | 困难 | |
141+
| [0128](https://leetcode-cn.com/problems/longest-consecutive-sequence) | [最长连续序列](/solution/0100-0199/0128.Longest%20Consecutive%20Sequence/README.md) | `并查集`,`数组` | 中等 | |
142142
| [0129](https://leetcode-cn.com/problems/sum-root-to-leaf-numbers) | [求根节点到叶节点数字之和](/solution/0100-0199/0129.Sum%20Root%20to%20Leaf%20Numbers/README.md) | ``,`深度优先搜索` | 中等 | |
143143
| [0130](https://leetcode-cn.com/problems/surrounded-regions) | [被围绕的区域](/solution/0100-0199/0130.Surrounded%20Regions/README.md) | `深度优先搜索`,`广度优先搜索`,`并查集` | 中等 | |
144144
| [0131](https://leetcode-cn.com/problems/palindrome-partitioning) | [分割回文串](/solution/0100-0199/0131.Palindrome%20Partitioning/README.md) | `深度优先搜索`,`动态规划`,`回溯算法` | 中等 | |
@@ -348,7 +348,7 @@
348348
| [0335](https://leetcode-cn.com/problems/self-crossing) | [路径交叉](/solution/0300-0399/0335.Self%20Crossing/README.md) | `数学` | 困难 | |
349349
| [0336](https://leetcode-cn.com/problems/palindrome-pairs) | [回文对](/solution/0300-0399/0336.Palindrome%20Pairs/README.md) | `字典树`,`哈希表`,`字符串` | 困难 | |
350350
| [0337](https://leetcode-cn.com/problems/house-robber-iii) | [打家劫舍 III](/solution/0300-0399/0337.House%20Robber%20III/README.md) | ``,`深度优先搜索`,`动态规划` | 中等 | |
351-
| [0338](https://leetcode-cn.com/problems/counting-bits) | [比特位计数](/solution/0300-0399/0338.Counting%20Bits/README.md) | `位运算`,`动态规划` | 中等 | |
351+
| [0338](https://leetcode-cn.com/problems/counting-bits) | [比特位计数](/solution/0300-0399/0338.Counting%20Bits/README.md) | `位运算`,`动态规划` | 简单 | |
352352
| [0339](https://leetcode-cn.com/problems/nested-list-weight-sum) | [嵌套列表权重和](/solution/0300-0399/0339.Nested%20List%20Weight%20Sum/README.md) | `深度优先搜索`,`广度优先搜索` | 中等 | 🔒 |
353353
| [0340](https://leetcode-cn.com/problems/longest-substring-with-at-most-k-distinct-characters) | [至多包含 K 个不同字符的最长子串](/solution/0300-0399/0340.Longest%20Substring%20with%20At%20Most%20K%20Distinct%20Characters/README.md) | `哈希表`,`双指针`,`字符串` | 中等 | 🔒 |
354354
| [0341](https://leetcode-cn.com/problems/flatten-nested-list-iterator) | [扁平化嵌套列表迭代器](/solution/0300-0399/0341.Flatten%20Nested%20List%20Iterator/README.md) | ``,`设计` | 中等 | |
@@ -761,7 +761,7 @@
761761
| [0748](https://leetcode-cn.com/problems/shortest-completing-word) | [最短补全词](/solution/0700-0799/0748.Shortest%20Completing%20Word/README.md) | `哈希表` | 简单 | |
762762
| [0749](https://leetcode-cn.com/problems/contain-virus) | [隔离病毒](/solution/0700-0799/0749.Contain%20Virus/README.md) | `深度优先搜索` | 困难 | |
763763
| [0750](https://leetcode-cn.com/problems/number-of-corner-rectangles) | [角矩形的数量](/solution/0700-0799/0750.Number%20Of%20Corner%20Rectangles/README.md) | `动态规划` | 中等 | 🔒 |
764-
| [0751](https://leetcode-cn.com/problems/ip-to-cidr) | [IP 到 CIDR](/solution/0700-0799/0751.IP%20to%20CIDR/README.md) | `位运算` | 简单 | 🔒 |
764+
| [0751](https://leetcode-cn.com/problems/ip-to-cidr) | [IP 到 CIDR](/solution/0700-0799/0751.IP%20to%20CIDR/README.md) | `位运算` | 中等 | 🔒 |
765765
| [0752](https://leetcode-cn.com/problems/open-the-lock) | [打开转盘锁](/solution/0700-0799/0752.Open%20the%20Lock/README.md) | `广度优先搜索` | 中等 | |
766766
| [0753](https://leetcode-cn.com/problems/cracking-the-safe) | [破解保险箱](/solution/0700-0799/0753.Cracking%20the%20Safe/README.md) | `深度优先搜索`,`数学` | 困难 | |
767767
| [0754](https://leetcode-cn.com/problems/reach-a-number) | [到达终点数字](/solution/0700-0799/0754.Reach%20a%20Number/README.md) | `数学` | 中等 | |
@@ -1883,6 +1883,7 @@
18831883
| [1870](https://leetcode-cn.com/problems/minimum-speed-to-arrive-on-time) | [准时到达的列车最小时速](/solution/1800-1899/1870.Minimum%20Speed%20to%20Arrive%20on%20Time/README.md) | `数学`,`二分查找` | 中等 | |
18841884
| [1871](https://leetcode-cn.com/problems/jump-game-vii) | [跳跃游戏 VII](/solution/1800-1899/1871.Jump%20Game%20VII/README.md) | `贪心算法`,`广度优先搜索` | 中等 | |
18851885
| [1872](https://leetcode-cn.com/problems/stone-game-viii) | [石子游戏 VIII](/solution/1800-1899/1872.Stone%20Game%20VIII/README.md) | `动态规划` | 困难 | |
1886+
| [1873](https://leetcode-cn.com/problems/calculate-special-bonus) | [Calculate Special Bonus](/solution/1800-1899/1873.Calculate%20Special%20Bonus/README_EN.md) | | 简单 | |
18861887

18871888
## 版权
18881889

solution/README_EN.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Press <kbd>Control</kbd>+<kbd>F</kbd>(or <kbd>Command</kbd>+<kbd>F</kbd> on the
136136
| [0125](https://leetcode.com/problems/valid-palindrome) | [Valid Palindrome](/solution/0100-0199/0125.Valid%20Palindrome/README_EN.md) | `Two Pointers`,`String` | Easy | |
137137
| [0126](https://leetcode.com/problems/word-ladder-ii) | [Word Ladder II](/solution/0100-0199/0126.Word%20Ladder%20II/README_EN.md) | `Breadth-first Search`,`Array`,`String`,`Backtracking` | Hard | |
138138
| [0127](https://leetcode.com/problems/word-ladder) | [Word Ladder](/solution/0100-0199/0127.Word%20Ladder/README_EN.md) | `Breadth-first Search` | Hard | |
139-
| [0128](https://leetcode.com/problems/longest-consecutive-sequence) | [Longest Consecutive Sequence](/solution/0100-0199/0128.Longest%20Consecutive%20Sequence/README_EN.md) | `Union Find`,`Array` | Hard | |
139+
| [0128](https://leetcode.com/problems/longest-consecutive-sequence) | [Longest Consecutive Sequence](/solution/0100-0199/0128.Longest%20Consecutive%20Sequence/README_EN.md) | `Union Find`,`Array` | Medium | |
140140
| [0129](https://leetcode.com/problems/sum-root-to-leaf-numbers) | [Sum Root to Leaf Numbers](/solution/0100-0199/0129.Sum%20Root%20to%20Leaf%20Numbers/README_EN.md) | `Tree`,`Depth-first Search` | Medium | |
141141
| [0130](https://leetcode.com/problems/surrounded-regions) | [Surrounded Regions](/solution/0100-0199/0130.Surrounded%20Regions/README_EN.md) | `Depth-first Search`,`Breadth-first Search`,`Union Find` | Medium | |
142142
| [0131](https://leetcode.com/problems/palindrome-partitioning) | [Palindrome Partitioning](/solution/0100-0199/0131.Palindrome%20Partitioning/README_EN.md) | `Depth-first Search`,`Dynamic Programming`,`Backtracking` | Medium | |
@@ -346,7 +346,7 @@ Press <kbd>Control</kbd>+<kbd>F</kbd>(or <kbd>Command</kbd>+<kbd>F</kbd> on the
346346
| [0335](https://leetcode.com/problems/self-crossing) | [Self Crossing](/solution/0300-0399/0335.Self%20Crossing/README_EN.md) | `Math` | Hard | |
347347
| [0336](https://leetcode.com/problems/palindrome-pairs) | [Palindrome Pairs](/solution/0300-0399/0336.Palindrome%20Pairs/README_EN.md) | `Trie`,`Hash Table`,`String` | Hard | |
348348
| [0337](https://leetcode.com/problems/house-robber-iii) | [House Robber III](/solution/0300-0399/0337.House%20Robber%20III/README_EN.md) | `Tree`,`Depth-first Search`,`Dynamic Programming` | Medium | |
349-
| [0338](https://leetcode.com/problems/counting-bits) | [Counting Bits](/solution/0300-0399/0338.Counting%20Bits/README_EN.md) | `Bit Manipulation`,`Dynamic Programming` | Medium | |
349+
| [0338](https://leetcode.com/problems/counting-bits) | [Counting Bits](/solution/0300-0399/0338.Counting%20Bits/README_EN.md) | `Bit Manipulation`,`Dynamic Programming` | Easy | |
350350
| [0339](https://leetcode.com/problems/nested-list-weight-sum) | [Nested List Weight Sum](/solution/0300-0399/0339.Nested%20List%20Weight%20Sum/README_EN.md) | `Depth-first Search`,`Breadth-first Search` | Medium | 🔒 |
351351
| [0340](https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters) | [Longest Substring with At Most K Distinct Characters](/solution/0300-0399/0340.Longest%20Substring%20with%20At%20Most%20K%20Distinct%20Characters/README_EN.md) | `Hash Table`,`Two Pointers`,`String`,`Sliding Window` | Medium | 🔒 |
352352
| [0341](https://leetcode.com/problems/flatten-nested-list-iterator) | [Flatten Nested List Iterator](/solution/0300-0399/0341.Flatten%20Nested%20List%20Iterator/README_EN.md) | `Stack`,`Design` | Medium | |
@@ -759,7 +759,7 @@ Press <kbd>Control</kbd>+<kbd>F</kbd>(or <kbd>Command</kbd>+<kbd>F</kbd> on the
759759
| [0748](https://leetcode.com/problems/shortest-completing-word) | [Shortest Completing Word](/solution/0700-0799/0748.Shortest%20Completing%20Word/README_EN.md) | `Hash Table` | Easy | |
760760
| [0749](https://leetcode.com/problems/contain-virus) | [Contain Virus](/solution/0700-0799/0749.Contain%20Virus/README_EN.md) | `Depth-first Search` | Hard | |
761761
| [0750](https://leetcode.com/problems/number-of-corner-rectangles) | [Number Of Corner Rectangles](/solution/0700-0799/0750.Number%20Of%20Corner%20Rectangles/README_EN.md) | `Dynamic Programming` | Medium | 🔒 |
762-
| [0751](https://leetcode.com/problems/ip-to-cidr) | [IP to CIDR](/solution/0700-0799/0751.IP%20to%20CIDR/README_EN.md) | `Bit Manipulation` | Easy | 🔒 |
762+
| [0751](https://leetcode.com/problems/ip-to-cidr) | [IP to CIDR](/solution/0700-0799/0751.IP%20to%20CIDR/README_EN.md) | `Bit Manipulation` | Medium | 🔒 |
763763
| [0752](https://leetcode.com/problems/open-the-lock) | [Open the Lock](/solution/0700-0799/0752.Open%20the%20Lock/README_EN.md) | `Breadth-first Search` | Medium | |
764764
| [0753](https://leetcode.com/problems/cracking-the-safe) | [Cracking the Safe](/solution/0700-0799/0753.Cracking%20the%20Safe/README_EN.md) | `Depth-first Search`,`Math` | Hard | |
765765
| [0754](https://leetcode.com/problems/reach-a-number) | [Reach a Number](/solution/0700-0799/0754.Reach%20a%20Number/README_EN.md) | `Math` | Medium | |
@@ -1881,6 +1881,7 @@ Press <kbd>Control</kbd>+<kbd>F</kbd>(or <kbd>Command</kbd>+<kbd>F</kbd> on the
18811881
| [1870](https://leetcode.com/problems/minimum-speed-to-arrive-on-time) | [Minimum Speed to Arrive on Time](/solution/1800-1899/1870.Minimum%20Speed%20to%20Arrive%20on%20Time/README_EN.md) | `Math`,`Binary Search` | Medium | |
18821882
| [1871](https://leetcode.com/problems/jump-game-vii) | [Jump Game VII](/solution/1800-1899/1871.Jump%20Game%20VII/README_EN.md) | `Greedy`,`Breadth-first Search`,`Line Sweep` | Medium | |
18831883
| [1872](https://leetcode.com/problems/stone-game-viii) | [Stone Game VIII](/solution/1800-1899/1872.Stone%20Game%20VIII/README_EN.md) | `Dynamic Programming` | Hard | |
1884+
| [1873](https://leetcode.com/problems/calculate-special-bonus) | [Calculate Special Bonus](/solution/1800-1899/1873.Calculate%20Special%20Bonus/README_EN.md) | | Easy | 🔒 |
18841885

18851886
## Copyright
18861887

solution/result.json

+1-1
Large diffs are not rendered by default.

solution/summary.md

+1
Original file line numberDiff line numberDiff line change
@@ -1908,3 +1908,4 @@
19081908
- [1870.Minimum Speed to Arrive on Time](/solution/1800-1899/1870.Minimum%20Speed%20to%20Arrive%20on%20Time/README.md)
19091909
- [1871.Jump Game VII](/solution/1800-1899/1871.Jump%20Game%20VII/README.md)
19101910
- [1872.Stone Game VIII](/solution/1800-1899/1872.Stone%20Game%20VIII/README.md)
1911+
- [1873.Calculate Special Bonus](/solution/1800-1899/1873.Calculate%20Special%20Bonus/README.md)

solution/summary_en.md

+1
Original file line numberDiff line numberDiff line change
@@ -1908,3 +1908,4 @@
19081908
- [1870.Minimum Speed to Arrive on Time](/solution/1800-1899/1870.Minimum%20Speed%20to%20Arrive%20on%20Time/README_EN.md)
19091909
- [1871.Jump Game VII](/solution/1800-1899/1871.Jump%20Game%20VII/README_EN.md)
19101910
- [1872.Stone Game VIII](/solution/1800-1899/1872.Stone%20Game%20VIII/README_EN.md)
1911+
- [1873.Calculate Special Bonus](/solution/1800-1899/1873.Calculate%20Special%20Bonus/README_EN.md)

0 commit comments

Comments
 (0)