The questions are still open and you can try them here.
The question was about dividing an array into K + 1 segments such that the minimum segment is maximized. The minimum segment is the segment that has the smallest sum of elements. If you don't remember the question, you can find it below.
There was also a restriction on where the array can be cut because of the caramels. To make the algorithm easier to write, we can first rewrite the array so that chunks of chocolates with caramels are grouped together. The solution will be equivalent.
Once we got rid of the caramels, there are multiple ways to solve this problem: