Clean python code


  • 0
    class Solution(object):
        def wiggleSort(self, nums):
            for i in xrange(1, len(nums)):
                if (i & 1 and nums[i] < nums[i - 1] or
                        not i & 1 and nums[i] > nums[i - 1]):
                    nums[i], nums[i - 1] = nums[i - 1], nums[i]

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.