Get Max Skill Sum
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:
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
1Example 1

[3, 4] with 1 marketing expert and 1 developer. The sum of skills is 3 + 4 = 7. Hence the answer is 7.