FastPrepTeam Formation
Problems/Team Formation

Team Formation

DoorDash logoDoorDash● MediumNEW GRADINTERNOA

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Special thanks: 🌷 A special thank you to a lovely, amazing fren for sharing that this question appeared again on October 16, 2026! ( ᴗ͈ˬᴗ͈)ഒ 🧡

Given a list of employees where each is assigned a numeric evaluation score, use the selection process below to find the sum of scores of selected employees.

  1. The employee with the highest score among the first k employees or the last k employees in the score list is selected.
  2. The selected employee is removed from the score list.
  3. The process continues to select the next employee until the team_size is achieved.

Note:

  • In case multiple employees have the same highest score, the employee with the lowest index is selected.
  • If there are fewer than k employees, the entire list is available for selection.

Function

teamFormation(score: int[], team_size: int, k: int) → int

Complete the function teamFormation in the editor.

teamFormation has the following parameter(s):

  1. score[n]: an array of scores for each employee
  2. team_size: the number of team members required
  3. k: the size of the array segments to select from

Examples

Example 1

score = [10, 20, 10, 15, 5, 30, 20]team_size = 2k = 3return = 50

For the first selection, choose from the first 3 elements: [10, 20, 10] or the last 3 elements: [5, 30, 20]. Score 30 is selected and removed from the list. This makes score = [10, 20, 10, 15, 5, 20].

For the second selection, choose from [10, 20, 10] or [15, 5, 20]. Score 20 is selected from the lowest index and removed from the list. This makes score = [10, 10, 15, 5, 20].

The sum of the selected employees' scores is 30 + 20 = 50.

Constraints

  • 🥝🥝

More DoorDash interview questions

  • Random Dasher Set OperationsONSITE INTERVIEW · Seen Nov 2026
  • Customer Bootstrap APIPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Dasher Pay with Store Waits and Peak HoursPHONE SCREEN · Seen Nov 2026
  • Simulate an Idempotent Refund Service FlowONSITE INTERVIEW · Seen Sep 2026
  • Dasher Active TimePHONE SCREEN · Seen Sep 2026
  • First Unique ID in a StreamONSITE INTERVIEW · Seen Aug 2026
  • Minimum Parenthesis Removals and Their IndicesONSITE INTERVIEW · Seen Aug 2026
  • Minimum Processing Speed with Multiple RidersONSITE INTERVIEW · Seen Aug 2026
  • Minimum Single-Rider Processing SpeedONSITE INTERVIEW · Seen Aug 2026
  • Merchant Capacity Interval MergePHONE SCREEN · Seen Aug 2026

Similar questions at other companies

  • Minimum Cost to Merge Values into OnePayPal · OAPayPal interview questions
  • Top K Frequent ElementsAmazon · OA · PHONE SCREEN
  • Maximum ScoreNVIDIA · OANVIDIA interview questions
  • Minimum Meeting RoomsJP Morgan Chase · OAJP Morgan Chase interview questions
  • Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
  • Meeting Rooms IIWise · OA
  • Rearrange Songs by AuthorZomato / Eternal · OAZomato / Eternal interview questions
  • Auction Sniping Window MinimumCisco · OACisco interview questions
  • Minimize the Sum with Ceiling HalvesSquarepoint Capital · OASquarepoint Capital interview questions
  • Effective ManagerGoldman Sachs · OAGoldman Sachs interview questions

DoorDash interview experiences

  • DoorDash SWE Onsite: Donation System Design: 1 Experience
  • DoorDash SWE Phone Screen: Bootstrap API in Java: 1 Experience
  • DoorDash SWE Virtual Onsite: 1 Experience
  • DoorDash SWE Phone Screen: Bootstrap API Parsing: 1 Experience
  • DoorDash Senior SWE Onsite Interview Experience: 1 Experience
  • DoorDash AI CodeCraft Interview: 8 Experiences
All DoorDash interview questionsSee DoorDash hiring insights
Saved
class Solution {
    public int teamFormation(int[] score, int team_size, int k) {
      // write your code here
    }

}
Checking account…