You're a project manager who needs to schedule a list of jobs over d days. The jobs have a strict dependency order - you must complete job i before you can start job i+1. Each job has a difficulty rating, and you must complete at least one job each day.
The difficulty of a day is determined by the most challenging job you complete that day. Your goal is to find a schedule that minimizes the total difficulty across all days.
Input: An integer array jobDifficulty where jobDifficulty[i] represents the difficulty of the i-th job, and an integer d representing the number of days available.
Output: Return the minimum total difficulty of the job schedule. If it's impossible to schedule all jobs in d days (i.e., you have more days than jobs), return -1.
Example: Jobs [6,5,4,3,2,1] over 2 days could be split as Day 1: [6,5,4] (difficulty = 6), Day 2: [3,2,1] (difficulty = 3), Total = 9.
Input & Output
Constraints
- 1 โค jobDifficulty.length โค 300
- 0 โค jobDifficulty[i] โค 1000
- 1 โค d โค 10
- The jobs must be completed in the given order
- At least one job must be completed each day