无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

LeetCode 1572. Matrix Diagonal Sum

2023-02-01 16:19 作者:您是打尖兒還是住店呢  | 我要投稿

Given a?square?matrix?mat, return the sum of the matrix diagonals.

Only include the sum of all the elements on the primary diagonal and all the elements on the secondary diagonal that are not part of the primary diagonal.

?

Example 1:

Input: mat = [[1,2,3], [4,5,6],[7,8,9]]

Output: 25

Explanation: Diagonals sum: 1 + 5 + 9 + 3 + 7 = 25?

Notice that element mat[1][1] = 5 is counted only once.

Example 2:

Input: mat = [[1,1,1,1],?[1,1,1,1],?[1,1,1,1], [1,1,1,1]]

Output: 8

Example 3:

Input: mat = [[5]]

Output: 5

?

Constraints:

  • n == mat.length == mat[i].length

  • 1 <= n <= 100

  • 1 <= mat[i][j] <= 100


Easy題目就不細(xì)說了。

Runtime:?0 ms, faster than?100.00%?of?Java?online submissions for?Matrix Diagonal Sum.

Memory Usage:?42.3 MB, less than?70.06%?of?Java?online submissions for?Matrix Diagonal Sum.


LeetCode 1572. Matrix Diagonal Sum的評論 (共 條)

分享到微博請遵守國家法律
盐边县| 苍南县| 岑溪市| 玛多县| 永登县| 颍上县| 焦作市| 孝感市| 禄劝| 安多县| 济宁市| 正阳县| 文昌市| 北流市| 衡东县| 靖安县| 蚌埠市| 突泉县| 沙湾县| 息烽县| 蓬莱市| 三门县| 库伦旗| 靖边县| 荆门市| 宣威市| 信丰县| 通州区| 道孚县| 扬中市| 乌兰县| 封丘县| 右玉县| 临潭县| 河南省| 图木舒克市| 东安县| 邳州市| 德保县| 栾城县| 婺源县|