a solution to Set Matrix Zeroes, but not the best