1873. Calculate Special Bonus LeetCode Solution
In this guide, you will get 1873. Calculate Special Bonus LeetCode Solution with the best time and space complexity. The solution to Calculate Special Bonus problem is provided in various programming languages like C++, Java, and Python. This will be helpful for you if you are preparing for placements, hackathons, interviews, or practice purposes. The solutions provided here are very easy to follow and include detailed explanations.
Table of Contents
- Problem Statement
- Complexity Analysis
- Calculate Special Bonus solution in C++
- Calculate Special Bonus solution in Java
- Calculate Special Bonus solution in Python
- Additional Resources

Problem Statement of Calculate Special Bonus
Table: Employees
+————-+———+
| Column Name | Type |
+————-+———+
| employee_id | int |
| name | varchar |
| salary | int |
+————-+———+
employee_id is the primary key (column with unique values) for this table.
Each row of this table indicates the employee ID, employee name, and salary.
Write a solution to calculate the bonus of each employee. The bonus of an employee is 100% of their salary if the ID of the employee is an odd number and the employee’s name does not start with the character ‘M’. The bonus of an employee is 0 otherwise.
Return the result table ordered by employee_id.
The result format is in the following example.
Example not found
Constraints not found
Complexity Analysis
- Time Complexity: Google AdSense
- Space Complexity: Google Analytics
1873. Calculate Special Bonus LeetCode Solution in C++
SELECT
employee_id,
IF(employee_id % 2 = 1 AND LEFT(name, 1) != 'M', salary, 0) AS bonus
FROM Employees
ORDER BY 1;
/* code provided by PROGIEZ */
1873. Calculate Special Bonus LeetCode Solution in Java
N/A
// code provided by PROGIEZ
1873. Calculate Special Bonus LeetCode Solution in Python
N/A
# code by PROGIEZ
Additional Resources
- Explore all LeetCode problem solutions at Progiez here
- Explore all problems on LeetCode website here
Happy Coding! Keep following PROGIEZ for more updates and solutions.