MCPcopy Create free account
hub / github.com/HuberTRoy/leetCode / right

Method right

Array/SpiralMatrix.py:59–73  ·  view source on GitHub ↗
(self, matrix, x, y, result, stop)

Source from the content-addressed store, hash-verified

57
58class Solution(object):
59 def right(self, matrix, x, y, result, stop):
60 if checkStop(matrix, x, y):
61 return result
62 while 1:
63 try:
64 # matrix
65 if matrix[y][x] == 'x':
66 raise IndexError
67 result.append(matrix[y][x])
68 matrix[y][x] = 'x'
69 x += 1
70
71 except IndexError:
72 x -= 1
73 return self.down(matrix, x, y+1, result, stop)
74
75 def down(self, matrix, x ,y, result, stop):
76 if checkStop(matrix, x, y):

Callers 2

upMethod · 0.95
spiralOrderMethod · 0.95

Calls 2

downMethod · 0.95
checkStopFunction · 0.85

Tested by

no test coverage detected