Created
September 16, 2017 02:28
-
-
Save cesarkawakami/8efca798245adbf3f59aa0a5d2a39267 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
def isolate_zeros(arr): | |
j = 0 | |
for i in range(len(arr)): | |
if arr[i]: | |
arr[j] = arr[i] | |
j += 1 | |
for i in range(j, len(arr)): | |
arr[i] = 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment