You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each row of this table indicates the employee ID, employee name, and salary.
30
+
31
+
</pre>
32
+
33
+
34
+
35
+
<p> </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>'M'</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> </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 'M'.
|[1873](https://leetcode-cn.com/problems/calculate-special-bonus)|[Calculate Special Bonus](/solution/1800-1899/1873.Calculate%20Special%20Bonus/README_EN.md)|| 简单 ||
|[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 ||
141
141
|[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 ||
142
142
|[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
346
346
|[0335](https://leetcode.com/problems/self-crossing)|[Self Crossing](/solution/0300-0399/0335.Self%20Crossing/README_EN.md)|`Math`| Hard ||
347
347
|[0336](https://leetcode.com/problems/palindrome-pairs)|[Palindrome Pairs](/solution/0300-0399/0336.Palindrome%20Pairs/README_EN.md)|`Trie`,`Hash Table`,`String`| Hard ||
348
348
|[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 ||
|[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 | 🔒 |
351
351
|[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 | 🔒 |
352
352
|[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
|[0749](https://leetcode.com/problems/contain-virus)|[Contain Virus](/solution/0700-0799/0749.Contain%20Virus/README_EN.md)|`Depth-first Search`| Hard ||
761
761
|[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| 🔒 |
763
763
|[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 ||
764
764
|[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 ||
765
765
|[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
1881
1881
|[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 ||
1882
1882
|[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 ||
1883
1883
|[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 | 🔒 |
0 commit comments