Given an array, you can merge two adjacent equal numbers into one; return the smallest final array after applying operations optimally.
A merge replaces equal adjacent values x, x with 2 * x. Choose the operations that produce the shortest final array; if several results have the same length, return the lexicographically smallest one. For signed values, a value created from a negative pair is not merged again.
Implement merge_equal_adjacent(nums), which accepts a list of integers and returns the resulting list.
Constraints:
1 <= len(nums) <= 200-10^9 <= nums[i] <= 10^9def merge_equal_adjacent(nums):