Given an array of integers, replace each element with the average of its neighbors. If an item is at the beginning or end, the average is the value of the single neighbor. You may assume there are at least 2 elements in the given array.