D days Job Scheduler
You work at a multinational corporation. Deadlines are taken way too seriously, i.e., if you are given a job with a deadline of D days, you must complete the job in exactly D days and you must complete at least one task in a day. But every task is not of the same difficulty.
Being a lazy person, you want to complete the job in the most effortless way possible. Let's say you want to complete three tasks in a day with difficulties as
[4,1,2], then the effort required to complete these tasks is the maximum of all tasks, i.e., 4. In other words, let's say you decide to do X tasks in a day with \(d_1, d_2, ..., d_x \) difficulties, the effort required to complete these tasks is maximum(\(d_1, d_2, ..., d_x\))
You need to find the minimum effort required to complete all the tasks.
The first line contains two integers, N and D. N represents the number of tasks, D represents the number of days.
Second line contains N integers -- \(d_1, d_2, d_3, ..., d_n\)
An integer, the minimum effort required.
\(1 \leq N \leq 300\)
\(1 \leq D \leq 10\)
\(0 \leq d_i \leq 1000\)
\(D \leq N\)
8 2 1 2 3 4 5 6 7 8
Explanation do the first task on Day1 and the rest of the tasks on Day2. (1 + 8) = 9
If we try to do all the tasks on day 1, the answer would be 8, but the conditions say that you have to do at least one task in a day, so there will be no tasks on day2. Hence it can not 8.