When I type in Atul's MATLAB code I get

M =

6 6 6 5 5 3
0 6 6 5 4 3
0 0 6 5 4 3
0 0 0 5 4 2
0 0 0 0 4 2
0 0 0 0 0 1

which is not the correct answer.