class : def wiggleSort(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ tmp = sorted(nums) for p, i in enumerate(range(0, len(nums), 2)): nums[i] = tmp[p] for p, i in enumerate(range(1, len(nums), 2)): nums[i] = tmp[-1-p]
|
近期评论