五月天青色头像情侣网名,国产亚洲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的評論 (共 條)

分享到微博請遵守國家法律
理塘县| 阿坝| 图们市| 锡林郭勒盟| 富川| 九台市| 安龙县| 怀仁县| 峡江县| 迁西县| 涟水县| 平陆县| 弥勒县| 蓬莱市| 安庆市| 刚察县| 杭锦旗| 清原| 甘孜县| 平舆县| 万荣县| 融水| 东台市| 陈巴尔虎旗| 弥勒县| 广西| 广宁县| 鄂托克前旗| 亚东县| 商河县| 砀山县| 霍林郭勒市| 兖州市| 厦门市| 桦川县| 香港 | 沂源县| 贵港市| 长治县| 定西市| 乌海市|