Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- def wiggleSort(self, nums):
- if len(nums) == 1:
- return
- arr = nums[:]
- arr.sort()
- i = len(arr) - 1
- k = 1
- while i >= 0:
- nums[k] = arr[i]
- k += 2
- if k >= len(nums):
- k = 0
- i -= 1
Advertisement
Add Comment
Please, Sign In to add comment