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

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

LeetCode 2614. Prime In Diagonal

2023-04-09 12:06 作者:您是打尖兒還是住店呢  | 我要投稿

You are given a 0-indexed two-dimensional integer array?nums.

Return?the largest?prime?number that lies on at least one of the?diagonals?of?nums. In case, no prime is present on any of the diagonals,?return 0.

Note that:

  • An integer is?prime?if it is greater than?1?and has no positive integer divisors other than?1?and itself.

  • An integer?val?is on one of thediagonals?of?nums?if there exists an integer?i?for which?nums[i][i] = val?or an?i?for which?nums[i][nums.length - i - 1]= val.

In the above diagram, one diagonal is?[1,5,9]?and another diagonal is?[3,5,7].

?

Example 1:

Input: nums = [[1,2,3],[5,6,7],[9,10,11]]

Output: 11

Explanation: The numbers 1, 3, 6, 9, and 11 are the only numbers present on at least one of the diagonals. Since 11 is the largest prime, we return 11.

Example 2:

Input: nums = [[1,2,3],[5,17,7],[9,11,10]]

Output: 17

Explanation: The numbers 1, 3, 9, 10, and 17 are all present on at least one of the diagonals. 17 is the largest prime, so we return 17.

?

Constraints:

  • 1 <= nums.length <= 300

  • nums.length == numsi.length

  • 1 <= nums[i][j]?<= 4*106

  • 作為一名數(shù)學(xué)系的學(xué)生,居然卡在了什么是素?cái)?shù),我又把1給忽略了,他不是素?cái)?shù)。。。。

Runtime:?14 ms, faster than?20.00%?of?Java?online submissions for?Prime In Diagonal.

Memory Usage:?51.7 MB, less than?100.00%?of?Java?online submissions for?Prime In Diagonal.


LeetCode 2614. Prime In Diagonal的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
互助| 竹溪县| 弥渡县| 昌宁县| 长岛县| 沈丘县| 荃湾区| 迁安市| 五大连池市| 南丹县| 正定县| 肃北| 奎屯市| 成安县| 额尔古纳市| 洛川县| 卫辉市| 靖远县| 布尔津县| 班玛县| 宜宾县| 灵宝市| 霍邱县| 交口县| 华池县| 曲阳县| 青神县| 达日县| 保德县| 苍溪县| 丽水市| 囊谦县| 平谷区| 中牟县| 溆浦县| 彰化市| 临沭县| 萨迦县| 平潭县| 吴忠市| 渭源县|