Domanda di colloquio di Yelp

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

Risposta di colloquio

Anonimo

22 lug 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.