RotCut

Given a rod of length n inches and an array of prices that contains
prices of all pieces of size smaller than n. Determine the maximum value
obtainable by cutting up the rod and selling the pieces. For example, if
length of the rod is 8 and the values of different pieces are given as
following, then the maximum obtainable value is 22