Amazon OA Sliding Window

Amazon · Question · Posted Jun 2023

You are hosting a hackathon. Each team will have exactly teamSize developers. A developer's skill level is denoted by skill[i]. The difference between the maximum and minimum skill levels within a team cannot exceed a threshold, maxDiff. Determine the maximum number of teams that can be formed from the contestants. Example: skill = [3, 4, 3, 1, 6, 5], teamSize = 3, maxDiff = 2: At most, 2 teams can be formed: [3, 3, 1] and [4, 6, 5]. The ...

The full answer & interview discussion are available to premium members.

Log in Create a free account