当前位置:网站首页>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;
}
}边栏推荐
- 关于el-date-picker点击清空参数变为null的问题
- Mysql事务中MVCC理解超简单
- L'enquête en aveugle a montré que les femmes étaient meilleures que les hommes.
- MySQL about auto increment sum cannot be empty
- Binary tree structure and heap structure foundation
- Code source AQS sous - jacent pour la programmation simultanée juc
- JS to determine whether the number entered by the user is a prime number (multiple methods)
- Etcd tutorial - Chapter 5 etcd etcdctl usage
- MySQL索引详解
- No matter how good LCD and OLED display technologies are, they cannot replace this ancient display nixie tube
猜你喜欢

JS to judge the odd and even function and find the function of circular area

UE5神通--POI解决方案
![[10. difference]](/img/15/ffd93da75858943fe887de1718e0f6.png)
[10. difference]
![[c++ primer notes] Chapter 4 expression](/img/cb/d543dd1f461653e9adf399b42d1d26.png)
[c++ primer notes] Chapter 4 expression

游戏资产复用:更快找到所需游戏资产的新方法
![[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](/img/05/19299c47d54d4ede95322b5a923093.png)
[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

SPARQL basic introductory exercise

【批处理DOS-CMD命令-汇总和小结】-输出/显示命令——echo

Blind survey shows that female code farmers are better than male code farmers

Lvgl description 3 about the use of lvgl Guide
随机推荐
[daily practice] realization of product card animation effect
JS find the number of all daffodils
JVM common garbage collector
Persistence mechanism of redis
「短视频」临夏消防救援支队开展消防安全培训授课
Implementation principle of similarity method in Oracle
JS print 99 multiplication table
C how to call line and rows when updating the database
SIG associé: toutes les routes mènent à ue5
【12. 最大连续不重复子序列】
期货反向跟单靠谱吗?
【c ++ primer 笔记】第4章 表达式
什么是期货反向跟单?
Set the address book function to database maintenance, and add user name and password
野風藥業IPO被終止:曾擬募資5.4億 實控人俞蘠曾進行P2P投資
(原创)自定义Drawable
Etcd教程 — 第五章 Etcd之etcdctl的使用
【批处理DOS-CMD命令-汇总和小结】-环境变量、路径变量、搜索文件位置相关指令——set、path、where,cmd命令的路径参数中有空格怎么办
Zabbix部署说明(Server+Win客户端+交换机(H3C))
Import and export database related tables from the win command line