You are given an integer array nums. In one operation you may pick two adjacent elements and replace them with their sum (shrinking the array by one).
Return the minimum number of operations needed to turn nums into a palindrome, an array that reads the same forwards and backwards. A single element is a palindrome.
Input: nums = [12,14,8,13,5]
Output: 3
Explanation: Merge 12+14 → [26,8,13,5], merge 13+5 → [26,8,18], merge 8+18 → [26,26]. Three operations produce a palindrome; fewer is impossible.
Input: nums = [1,2,3]
Output: 1
Explanation: Merge 1+2 → [3,3].
nums.length ≤105nums[i] ≤109