当前位置:网站首页>2022.06.26(LC_6101_判断矩阵是否是一个 X 矩阵)
2022.06.26(LC_6101_判断矩阵是否是一个 X 矩阵)
2022-06-27 08:12:00 【Leeli9316】

方法:模拟
class Solution {
public boolean checkXMatrix(int[][] grid) {
int n = grid.length;
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) {
return false;
}
} else {
if (grid[i][j] != 0) {
return false;
}
}
}
}
return true;
}
}边栏推荐
猜你喜欢

Programming life - what do you think of the 35 year old bottleneck of programmers?

Redis installation under Linux

win10-如何管理开机启动项?

win命令行中导入、导出数据库相关表

"Short video" Linxia fire rescue detachment carries out fire safety training

野风药业IPO被终止:曾拟募资5.4亿 实控人俞蘠曾进行P2P投资

2022 love analysis · panoramic report of it operation and maintenance manufacturers

Associated GIS: all roads lead to ue5 City

MySQL lock details

Helix QAC更新至2022.1版本,将持续提供高标准合规覆盖率
随机推荐
What are the specialties of database system engineers?
Experience record of Luogu's topic brushing
【云原生】2.3 Kubernetes 核心实战(上)
[paper reading] internally semi supervised methods
Associated GIS: all roads lead to ue5 City
什么是期货反向跟单?
Rust async: SMOL source code analysis -executor
關聯GIS:條條道路通UE5城
Mysql事务中MVCC理解超简单
MySQL环境变量配置的教程
二叉树结构以及堆结构基础
ArrayList和LinkedList的区别
Time function calculation efficiency of C
无论LCD和OLED显示技术有多好,都无法替代这个古老的显示数码管
JS find the number of all daffodils
【每日一练】产品卡片动画效果的实现
SPARQL基础入门练习
关于el-date-picker点击清空参数变为null的问题
c的时间函数算效率
MySQL about auto increment sum cannot be empty