Team Formation

Problem Overview

  • Build a team by repeatedly selecting the highest score from the first k or last k employees, removing the pick each round, until team_size; break ties by lowest index.
  • Input: score array, team_size, k; Output: sum of selected scores; if fewer than k remain, all remaining are eligible.
  • Real-world context: forming a team from employee evaluation scores.
  • From Doordash interviews; a coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: