not_alone¶
We’ll say that an element in a list is “alone” if there are values before and after it, and those values are different from it. Return a version of the given list where every instance of the given value which is alone is replaced by whichever value to its left or right is larger.
This exercise was taken from codingbat.com and has been adapted for the Python language. There are many great programming exercises there, but the majority are created for Java.