当前位置:网站首页>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;
}
}
边栏推荐
- DataV轮播表组件dv-scroll-board宽度问题
- 参考 | 升级 Win11 移动热点开不了或者开了连不上
- 【10. 差分】
- Implementation of game hexagon map
- AQS underlying source code of concurrent programming JUC
- 盲測調查顯示女碼農比男碼農更優秀
- LVGL GUI GUIDER移植代码到STM32
- Redis配置文件详解
- PayPal account has been massively frozen! How can cross-border sellers help themselves?
- 关于el-date-picker点击清空参数变为null的问题
猜你喜欢
【云原生】2.3 Kubernetes 核心实战(上)
Implementation of game hexagon map
Lvgl usage demo and instructions 2
Redis五种基本类型
L'enquête en aveugle a montré que les femmes étaient meilleures que les hommes.
05 观察者(Observer)模式
After working in a large factory for ten years with an annual salary of 400000 yuan, I was suddenly laid off. If the company wanted to abandon you, it wouldn't leave any kindness
【批处理DOS-CMD命令-汇总和小结】-cmd的内部命令和外部命令怎么区分,CMD命令和运行(win+r)命令的区别,
JS to determine whether the number entered by the user is a prime number (multiple methods)
Recognize the ordering of O (nlogn)
随机推荐
准备好迁移上云了?请收下这份迁移步骤清单
Index +sql exercise optimization
游戏资产复用:更快找到所需游戏资产的新方法
关于el-date-picker点击清空参数变为null的问题
2022 love analysis · panoramic report of it operation and maintenance manufacturers
[daily practice] realization of product card animation effect
Helix QAC is updated to 2022.1 and will continue to provide high standard compliance coverage
期货反向跟单靠谱吗?
[10. difference]
Online text digit recognition list summation tool
【10. 差分】
【批处理DOS-CMD命令-汇总和小结】-输出/显示命令——echo
JS example print the number and sum of multiples of all 7 between 1-100
Ready to migrate to the cloud? Please accept this list of migration steps
c#的初步认识
Rust async: SMOL source code analysis -executor
SQL Sever column name or number of supplied values does not match the table definition
lvgl 说明3关于lvgl guider的使用
[batch dos-cmd command - summary and summary] - parameters%0,%1,%2,%[0-9],%0-9 in the batch command and batch command parameter position switching command shift, operator% usage in the DOS command
八大误区,逐个击破(终篇):云难以扩展、定制性差,还会让管理员失去控制权?