A company wants to hire new employees with a budget of $70,000 for salaries. The hiring criteria are:
- First priority: Hire the largest number of seniors possible
- Second priority: Use the remaining budget to hire the largest number of juniors
Given a table of candidates with their experience level and salary, determine how many seniors and juniors can be hired under these constraints.
The result should show the count of each experience level that can be hired within budget.
Table Schema
| Column Name | Type | Description |
|---|---|---|
employee_id
PK
|
int | Unique identifier for each candidate |
experience
|
enum | Experience level: 'Senior' or 'Junior' |
salary
|
int | Monthly salary requirement |
Input & Output
| employee_id | experience | salary |
|---|---|---|
| 1 | Senior | 10000 |
| 2 | Junior | 10000 |
| 3 | Senior | 20000 |
| 4 | Junior | 30000 |
| experience | accepted_candidates |
|---|---|
| Senior | 2 |
| Junior | 1 |
With a $70,000 budget: First, hire seniors by salary order: Senior 1 ($10,000) + Senior 3 ($20,000) = $30,000. Remaining budget: $40,000. Then hire juniors: Junior 2 ($10,000) fits, but Junior 4 ($30,000) would exceed remaining budget. Total: 2 seniors + 1 junior.
| employee_id | experience | salary |
|---|---|---|
| 1 | Senior | 80000 |
| 2 | Junior | 10000 |
| 3 | Junior | 20000 |
| experience | accepted_candidates |
|---|---|
| Senior | 0 |
| Junior | 2 |
No seniors can be hired as the cheapest senior costs $80,000, exceeding the $70,000 budget. Full budget goes to juniors: Junior 2 ($10,000) + Junior 3 ($20,000) = $30,000. Total: 0 seniors + 2 juniors.
| employee_id | experience | salary |
|---|---|---|
| 1 | Senior | 20000 |
| 2 | Senior | 30000 |
| 3 | Junior | 50000 |
| experience | accepted_candidates |
|---|---|
| Senior | 2 |
| Junior | 0 |
Hire seniors first: Senior 1 ($20,000) + Senior 2 ($30,000) = $50,000. Remaining budget: $20,000. Junior 3 costs $50,000, which exceeds the remaining budget. Total: 2 seniors + 0 juniors.
Constraints
-
1 ≤ employee_id ≤ 1000 -
experienceis either'Senior'or'Junior' -
1 ≤ salary ≤ 100000 -
The company's budget is exactly
$70000