When looking at nested loops, it is easier to follow them if you record not just the number of iterations, but also "which row and column you are currently on." Start by making sure you do not swap ...