Rod Cutting

easy
1. You will be given a rod of length n units and an integer array of prices that consists of prices of all pieces of size less than n
 2. You need to find maximum price that can be acheived by cutting the rod and selling its pieces
 3. Input is handled for you
 4. It is a functional problem ,please do not modify main()

Input Format

Input is handled for you

Output Format

Print maximum price possible by selling pieces of given rod

Constraints

1 <= n <= 100
 1 <= A[i] <= 100

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
8
7 2 8 9 3 4 6 10
Output
56
Previous
Regular Expression Matching
Next
Russian Doll Envelopes

Related Questions