Get Max Skill Sum
Learn this problemProblem statement
A manager at Amazon is managing a team of n employees with IDs numbered from 0 to n - 1. Some employees are marketing experts and others are developers. The employee with id i has a skill level of skill[i]. The employee is a marketing expert if expertise[i] is 0 and a developer if expertise[i] is 1.
The manager wants to select a team to work on a project with some contiguous set of ids [i, i + 1, i + 2, ..., j] such that there is an equal number of marketing experts and developers and the total sum of skills is maximized.
Given two arrays, skill and expertise, find the maximum possible sum of skills of any team that can be formed respecting the above conditions.
Note:
Function
getMaxSkillSum(expertise: int[], skill: int[]) → long
Complete the function getMaxSkillSum in the editor.
getMaxSkillSum takes the following arguments:
int expertise[n]: the expertise of the employeesint skill[n]: the skill level of the employees
Returns
long: the maximum possible sum of skill levels of the team
Examples
Example 1
expertise = [0, 0, 0, 1]skill = [10, 2, 3, 4]return = 7
[3, 4] with 1 marketing expert and 1 developer. The sum of skills is 3 + 4 = 7. Hence the answer is 7.More Amazon problems
- Secure Maximum DeliveriesOA · Seen Jul 2026
- Find Median from Data StreamONSITE INTERVIEW · Seen Jul 2026
- Handwritten SigmoidPHONE SCREEN · Seen Jul 2026
- Handwritten SoftmaxPHONE SCREEN · Seen Jul 2026
- Koko Eating BananasONSITE INTERVIEW · Seen Jul 2026
- Loyal Customers Across Two DaysONSITE INTERVIEW · Seen Jul 2026
- Maximum System Memory CapacityOA · Seen Jul 2026
- Package Delivery SystemOA · Seen Jul 2026