Find Minimum Days
A student is preparing for a scholarship test which is organized on the Amazon Academy platform and scheduled for next month.
There are n chapters to be studied where the ith chapter has pages[i] pages. In one day, the student decides to read up to p of the remaining pages, each from some k consecutive chapters. Thus, the number of pages remaining to be read is reduced by p from each of these chapters. If a chapter has less than p pages remaining, the student reads the remaining pages, and the remaining page count is set to 0 for subsequent days. Find the minimum number of days the student needs to read all the chapters completely, i.e., the remaining page count of all chapters is 0.
Note: The chapters read must be contiguous.
Complete the function findMinimumDays in the editor below.
findMinimumDays has the following parameters:
int pages[n]: the number of pages in each chapterint k: the number of chapters chosen each dayint p: the maximum number of pages read from each chapter in a day
Returns
long int: the minimum number of days to read all pages of all chapters
π· Endless thanks to a super important old friend who has always been there to help! ππ
1Example 1

- Choose chapters 1 and 2, remaining pages to be read = [1, 0, 4]
- Choose chapters 1 and 2, remaining pages to be read = [0, 0, 4]
- Choose chapters 2 and 3, remaining pages to be read = [0, 0, 2]
- Finally, choose chapters 2 and 3, remaining pages to be read = [0, 0, 0]
2Example 2
Constraints
Limits and guarantees your solution can rely on.
1 β€ n β€ 10^51 β€ pages[i] β€ 10^91 β€ k β€ n1 β€ p β€ 10^9