class Solution {
public:
bool checkXMatrix(vector<vector<int>>& grid) {
int n = grid.size();
bool flag = true;
for(int i = 0;i < n;i++)
{
for(int j = 0;j < n;j++)
{
if(i == j || i + j == n - 1)
{
if(grid[i][j] == 0)
{
flag = false;
break;
}
}
else
{
if(grid[i][j] != 0)
{
flag = false;
break;
}
}
}
}
return flag;
}
};
标签:false,2319,int,矩阵,flag,grid,bool,LeetCode
From: https://www.cnblogs.com/zjacky/p/17081512.html