Yelp Interview Question

Given a 2D array, how do you print "spirally"?

Interview Answer

Anonymous

Jul 22, 2017

Have limits on for x_min and x_max along with y_min and y_max. As you print the matrix, increment decrement the min/maxes as necessary. You can keep a visited set to make sure not to print something that has already been printed.