Assign Escalations to Teams
Updated
Problem statement
There are n customer escalations, numbered 0 to n - 1, and three teams, numbered 0, 1 and 2. values[i][t] is the business value of giving escalation i to team t. When values[i][t] is -1, team t cannot handle escalation i.
Team t can take at most capacities[t] escalations. Every escalation must be given to exactly one team that can handle it.
Examples
Example 1
values = [[10,5,-1],[7,12,4],[-1,8,15],[9,-1,6]]capacities = [1,2,1]return = 41Give escalation 0 to team 1 (5), escalation 1 to team 1 (12), escalation 2 to team 2 (15) and escalation 3 to team 0 (9): 5 + 12 + 15 + 9 = 41. Team 1 takes two escalations, which its capacity 2 allows. Giving escalation 0 to team 0 for 10 instead leaves only team 2 for escalation 3, and the best total after that choice is 10 + 12 + 8 + 6 = 36.
Unlock this recently reported problem
FastPrep Pro gives you full access to interview problems reported within the last week.
- Full problem statement and constraints
- 2 more worked examples, explained
- Guided hints and editorial
- Run your code on real test cases
$99 billed yearly — or $19 month-to-month. Cancel anytime.
More Amazon Onsite Interview questions
- Best Time to Buy and Sell StockONSITE INTERVIEW · Seen Nov 2026
- Course SchedulePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Maximum Earnings Across WarehousesONSITE INTERVIEW · Seen Nov 2026
- Priority Message BufferONSITE INTERVIEW · Seen Nov 2026
- Search in a Rotated Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Top K Frequent ElementsOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- LRU Cache for Query ResultsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Maximal SquareONSITE INTERVIEW · Seen Nov 2026
- Serialize and Deserialize a Binary TreeONSITE INTERVIEW · Seen Nov 2026
- Course Schedule IIPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
Similar questions at other companies
- Maximum All-Ones Square Side LengthOmnissa · ONSITE INTERVIEWOmnissa interview questions
- Minimum Path SumMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Minimum Path SumBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
- Bomb Enemy Best CoordinatesSambaNova Systems · ONSITE INTERVIEWSambaNova Systems interview questions
- Largest Square of Ones in a GridExpedia · ONSITE INTERVIEWExpedia interview questions
- Longest Increasing Path in a MatrixNew Relic · PHONE SCREEN · ONSITE INTERVIEW
- Longest Increasing Path in a MatrixVisa · ONSITE INTERVIEWVisa interview questions
- Maximal Rectangle in a Binary MatrixGoogle · ONSITE INTERVIEWGoogle interview questions
- Find Robots by Blocker DistancesUber · PHONE SCREENUber interview questions
- Largest Square of OnesOpenAI · OAOpenAI interview questions
Amazon interview experiences
- Amazon Experienced SDE Onsite Questions: 1 Experience
- Amazon SDE Onsite Interview Questions: 9 Experiences
- Amazon SDE II and L5 FDE Interview Questions: 4 Experiences
- Amazon Full-Time OA Problems, Earlier Reports (Part 5 of 5)
- Amazon Full-Time OA Problems, Recent Reports (Part 4 of 5)
- Amazon New Grad OA Problems: Every Task We Have (Part 3 of 5)