五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(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的評論 (共 條)

分享到微博請遵守國家法律
太原市| 慈利县| 凤凰县| 伊春市| 来凤县| 三明市| 尉氏县| 长沙县| 长宁区| 宝兴县| 徐水县| 英超| 翁源县| 乌兰县| 民乐县| 蒲城县| 开平市| 历史| 宁南县| 盱眙县| 安达市| 蕉岭县| 平谷区| 茌平县| 新宁县| 大英县| 南充市| 平塘县| 弥渡县| 谢通门县| 土默特右旗| 盘山县| 庆云县| 淄博市| 定陶县| 新干县| 巴林右旗| 丹东市| 宁津县| 贵溪市| 松潘县|