use constant space, rewrite input matrix