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

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

LeetCode 542. 01 Matrix

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

Given an?m x n?binary matrix?mat, return?the distance of the nearest?0?for each cell.

The distance between two adjacent cells is?1.

?

Example 1:


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

Output: [[0,0,0],[0,1,0],[0,0,0]]

Example 2:

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

Output: [[0,0,0],[0,1,0],[1,2,1]]

?

Constraints:

  • m == mat.length

  • n == mat[i].length

  • 1 <= m, n <= 104

  • 1 <= m * n <= 104

  • mat[i][j]?is either?0?or?1.

  • There is at least one?0?in?mat.

BFS計(jì)算,算是經(jīng)典題目;得多練練這個(gè)。

Runtime:?13 ms, faster than?77.51%?of?Java?online submissions for?01 Matrix.

Memory Usage:?44.3 MB, less than?92.71%?of?Java?online submissions for?01 Matrix.


LeetCode 542. 01 Matrix的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
怀安县| 大英县| 北宁市| 交口县| 临江市| 开原市| 新巴尔虎右旗| 米林县| 兴仁县| 宜宾市| 巴青县| 惠水县| 高陵县| 浠水县| 永泰县| 时尚| 双流县| 寿光市| 襄汾县| 格尔木市| 开江县| 梨树县| 工布江达县| 富锦市| 东乡族自治县| 荔浦县| 依兰县| 雷山县| 延寿县| 淮安市| 广汉市| 霍山县| 扶风县| 大丰市| 建昌县| 郸城县| 武山县| 七台河市| 安龙县| 阳西县| 庄浪县|