Dsa
Dynamic Programming
Easy
Optimal Task Scheduling
A team has a list of tasks, each with a specific duration. They can complete a task only if all preceding tasks are completed. These tasks also have score rewards associated with them upon completion. Your goal is to maximize the score obtained by completing the tasks. You have the ability to skip completing one task to potentially optimize your score.
Input format:
The first line contains an integer n (1 <= n <= 1000) - the number of tasks.
The second line contains n space-separated integers representing the durations of the tasks.
The third line contains n space-separated integers representing the scores for each task.
Output format:
Print the maximum score obtainable.
Example:
Input:
3
1 2 3
10 20 30
Output:
50
Key concepts
dynamic_programmingschedulingmaximization
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