This is a verified interview question from Atlassian. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Optimal Team Size for Hackathon - Atlassian IIT Roorkee Online Assessment OA" covers key patterns like Other.
"### Problem There are n developers, where the skill level of the ith developer is given by i, for 1 ≤ i ≤ n. A developer agrees to be on the team only if certain conditions are met. Given two arrays, lowerSkill and higherSkill, the ith developer will join the team if at most lowerSkill[i] team members have a lower skill level than them, and at most higherSkill[i] team members have a higher skill level than them. The objective is to select the largest possible team such that every developer on the team agrees with the team composition based on these conditions. ### Example Given n = 5, lowerSkill = [1,3,2,2,2] higherSkill = [2,2,1,1,3] It is optimal to select developers with skill levels 1, 3, and 4. For the developer with skill level 1, there are two developers with higher skill levels and lowerSkill[1] = 2 . For the developer with skill level 3, there is one developer with a lower skill level and one with a higher skill level with higherSkill[3]=[1] . For the developer with skill level 4, there are two developers with lower skill levels. Thus, all three developers are content. Hence, the number of developers selected for the hackathon team will be 3. It can be shown that this is the maximum possible number of developers that can be selected under these conditions. ### Function Description Complete the function getOptimalTeamSize in the editor below. ### Function Parameters: - int lowerSkill[n] : the maximum number of team members in the hackathon whose skill level is lower than the ith developer - int higherSkill[n] : the maximum number of team members in the hackathon whose skill level is higher than the ith developer ### Returns - int : the maximum number of developers on a team ### Hint : Try to think about Binary Search"
Join thousands of developers practicing for Atlassian.