You are given an integer array nums.
You repeatedly merge adjacent equal elements in the array. Whenever two adjacent elements have the same value, they are replaced by a single element equal to their sum. This merge operation is applied repeatedly until no two adjacent elements in the array are equal.
Return the resulting array after all possible merges are performed.
Constraints:
nums.length
nums[i]
You are given an integer array nums.
You repeatedly merge adjacent equal elements in the array. Whenever two adjacent elements have the same value, they are replaced by a single element equal to their sum. This merge operation is applied repeatedly until no two adjacent elements in the array are equal.
Return the resulting array after all possible merges are performed.
Constraints:
nums.length
nums[i]