Given a rehabilitation session cost A[]
that represents cost at each day, number of required sessions X
, and the required reset time between each two sessions Y.
Find the minimum cost to have all required sessions satisfying the required rest time condition.
Example: A = {4, 2, 3, 7}, X=2, Y=2
answer should be 7 since the minimal cost to have two sessions with two days in between is to have the sessions at day 1, A[0]
and day 3, A[2]