Replace every element of an array with the sum of the next 2 elements in the most optimal way.
Treat missing elements beyond the array as zero. Modify the array in place and return it. The function must use the original values when calculating every replacement.
Function: def replace_with_next_two(nums): accepts a list of integers and returns the modified list.
def replace_with_next_two(nums):