Now all non - zero elements have been shifted to front and ' count ' is set as index of first 0. Make all elements 0 from count to end .
while count < n : NEW_LINE INDENT arr [ count ] = 0 NEW_LINE count += 1 NEW_LINE DEDENT