报错求助:NameError: name 'List' is not defined [Finished in 1.6s]
class Solution:
def power(self, matrix: List[List[int]]) -> List[int]:
if not matrix : return []
res = []
while matrix:
res.extend(matrix.pop(0))
next_matrix = []
for x in zip(*matrix):
next_matrix.append(x)
matrix = next_matrix[::-1]
return res
matrix = [[1,2,3],[4,5,6],[7,8,9]]
Solusion().power(matrix)
print(Solusion().power(matrix))
感谢大神