Created
August 2, 2012 07:16
-
-
Save Jam6808/3234737 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def not_alone(nums, val): | |
for e in nums: | |
if e == val: | |
s = nums.index(e) | |
if s != 0 and s != (len(nums) - 1): | |
nums[s] = max(nums[s-1], nums[s+1]) | |
return nums |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment