Combine Palindromes

Given an array of positive integers,we would like to convert it to a palindrome. To convert it to a palindrome we are only allowed to combine adjacent pairs (add them together). For example for the array [3, 5, 2, 1] we combine 2 and 1 to get [3, 5, 3] which is a palindrome.

For the array in the text file, what is the minimum number of combinations required to convert it to a palindrome?

Explicit examples:
[1, 2, 3, 2, 1] : 0 combination.
[1, 2, 5, 7]: 3 combinations.

×

Problem Loading...

Note Loading...

Set Loading...