Log In

You have written code that goes through the outer edge of a square matrix. Can you write code that first goes through the outer edge, and then through the next most outer edge?

For example, given this input:

The output of the function would be:

In this case, only the M would not be traversed.

For now, it is fine to simply make 4 more loops for . In the next step, we can think about how to generalize the full spiral.

Sign Up or Log In to access the code editor and answer the question!
Log In