notAlone: replace each lonely val
An element is "alone" if there are values before and after it, and those values are different from it. Return a version of the array where every instance of val that is alone is replaced by whichever of its two neighbours is larger. Step through notAlone: the loop skips the first and last boxes, since they don't have a neighbour on both sides. This code changes the array it was given and returns it.