Problem Description
You are given N potions arranged in a row in the form of an array A.
Each potion has one of 100 different colors (colors have numbers from 0 to 99).
You need to mix all these potions together.
At each step, you are going to take two potions that stand next to each other and mix them together,
and put the resulting mixture in their place.
When mixing two mixtures of colors X and Y, the resulting mixture will have the color (X + Y) mod 100.
Also, there will be some smoke in the process. The amount of smoke generated when mixing two mixtures of colors X and Y is X * Y.
Find out what is the minimum amount of smoke that you can get when mixing all the potions together.
A = [2, 3]
Input 2:
A = [2, 3, 4, 5]
6
Output 2:
71
There are only two potions given. Upon mixing them, we get 2 * 3 = 6 amounts of smoke.
Explanation 2:
Out of all the possible order of operations of mixing the given potions, the minimum amount of smoke you can get is 71.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.