Dsa
Dynamic Programming
Easy
Office Seating Arrangement
You are responsible for arranging the seating in a conference room for an office meeting. The room has a fixed number of seats arranged in a line, and you have a list of employee preferences for where they would like to sit. Each employee has a preference score associated with a specific seat in front of them, and you want to maximize the total preference score by assigning seats to employees optimally. Given a list of employee preference scores for each seat, return the maximum total preference score you can achieve.
Input format:
- The first line contains an integer n (1 ≤ n ≤ 100), the number of seats.
- The second line contains n integers representing the employee preference scores for each seat.
Output format:
- Output a single integer, the maximum total preference score achievable.
Example:
Input:
4
1 3 5 2
Output:
9
Key concepts
dynamic_programmingarraygreedy
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now