Created
December 31, 2017 11:36
-
-
Save tamlt2704/e16b69e8b3f74f14bde3f52c025e6e9c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #https://leetcode.com/problems/move-zeroes/description/ | |
| class Solution(object): | |
| def moveZeroes(self, nums): | |
| """ | |
| :type nums: List[int] | |
| :rtype: void Do not return anything, modify nums in-place instead. | |
| """ | |
| zero = 0 | |
| for i in xrange(0, len(nums)): | |
| if nums[i] != 0: | |
| nums[i], nums[zero] = nums[zero], nums[i] | |
| zero += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment