Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
spiral matrix
import sys
file = open(sys.argv[1])
lst = []
for line in file:
def spiral(matrix):
return list(matrix[0]) + spiral(list(reversed(zip(*matrix[1:])))) if matrix else []
print " ".join(spiral(lst))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.