There are n boxes with money enumerated from 0 to n − 1. The box I have mi dollars inside. When you pick box j, you are awarded mj−1 · MJ · mj+1 dollars, the box j is removed so that box j − 1 is neighboring with box j + 1. Implement the algorithm which finds the optimal way of picking boxes so that your total award is maximized. Your input will be given as an ArrayList of int to the function PickBoxes and your output will be an integer number - the best total award.
Get Free Quote!
385 Experts Online