Consider you are walking. The task is to drink juice and get the maximum possible power from juices. Juice stalls locations are given as an array x1 < x2 < ….. < xn-1 < xn, specifying position in metres measured from one end of the road. If you drink juice at position xi you receive power of pi > 0. There is a restriction that you cannot drink juice within t metres or less than it. M is the length of the road in metres.
Input : M = 20
x = {6, 7, 12, 13, 16, 20}
power = {5, 6, 5, 3, 1, 10}
t = 5
Ans = 20 (Drink juice from 6, 12 and 20 location)