Update array-move-zeros-inplace.py

This commit is contained in:
bt3gl 2023-07-30 15:54:34 -07:00 committed by GitHub
parent e96bf43463
commit 3b218fae01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,3 +1,8 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# author: bt3gl
'''
Given an integer array nums, move all 0's to the end of it while
maintaining the relative order of the non-zero elements.
@ -39,4 +44,4 @@ def move_zeroes(nums: list[int]) -> list[int]:
if __name__ == "__main__":
nums = [0,1,0,3,12]
assert(move_zeroes(nums) == [1,3,12,0,0])
assert(move_zeroes(nums) == [1,3,12,0,0])