My solution with ruby may be shortest


  • 0
    H
    def move_zeroes(nums)
        zero_count = nums.count(0)
        nums.delete(0)
        zero_count.times{ nums << 0 }
    end

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.