Moving Zeros To The End(codewar) 题目: Write an algorithm that takes an array and moves all of the zeros to the end, preserving the order of the other elements. move_zeros([ 1, 0, 1, 2, 0, 1, 3])#returns [1, 1, 2, 1, 3, 0, 0] 我的答案1:time 573ms defmove_zeros...
Moving Zeros Given an arraynums, write a function to move all0's to the end of it while maintaining the relative order of the non-zero elements. For example, givennums = [0, 1, 0, 3, 12], after calling your function,numsshould be[1, 3, 12, 0, 0]. Note: You must do this ...