本题不清楚题意,从网上找到了python的解答,记录如下. class Solution: def numMagicSquaresInside(self, grid): ans, lrc = 0, [len(grid), len(grid[0])] def checkMagic(a,b, c, d, e, f, g ,h, i): return (sorted([a,b,c,d,e,f,g,h,i]) == [i for i in range(1,10)] and (a + b+c == d +…