leetcode.cn 2026-10-25
🟡1254.number-of-closed-islands
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #matrix
🟡1254.number-of-closed-islands
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #matrix
Telegraph
number-of-closed-islands
二维矩阵 grid 由 0 (土地)和 1 (水)组成。岛是由最大的4个方向连通的 0 组成的群,封闭岛是一个 完全 由1包围(左、上、右、下)的岛。 请返回 封闭岛屿 的数目。 示例 1: 输入:grid = [[1,1,1,1,1,1,1,0],[1,0,0,0,0,1,1,0],[1,0,1,0,1,1,1,0],[1,0,0,0,0,1,0,1],[1,1,1,1,1,1,1,0]] 输出:2 解释: 灰色区域的岛屿是封闭岛屿,因为这座岛屿完全被水域包围(即被 1 区域包围)。 示例 2: 输入:grid…
leetcode.com 2026-10-25
🟡1254.number-of-closed-islands
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #matrix
🟡1254.number-of-closed-islands
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #matrix
Telegraph
number-of-closed-islands
Given a 2D grid consists of 0s (land) and 1s (water). An island is a maximal 4-directionally connected group of 0s and a closed island is an island totally (all left, top, right, bottom) surrounded by 1s. Return the number of closed islands. Example 1:…
leetcode.cn 2026-10-26
🟡3619.count-islands-with-total-value-divisible-by-k
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #matrix
🟡3619.count-islands-with-total-value-divisible-by-k
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #matrix
Telegraph
count-islands-with-total-value-divisible-by-k
给你一个 m x n 的矩阵 grid 和一个正整数 k。一个 岛屿 是由 正 整数(表示陆地)组成的,并且陆地间 四周 连通(水平或垂直)。 一个岛屿的总价值是该岛屿中所有单元格的值之和。 返回总价值可以被 k 整除 的岛屿数量。 示例 1: 输入: grid = [[0,2,1,0,0],[0,5,0,0,5],[0,0,1,0,0],[0,1,4,7,0],[0,2,0,0,8]], k = 5 输出: 2 解释: 网格中包含四个岛屿。蓝色高亮显示的岛屿的总价值可以被 5 整除,而红色高亮显示的岛屿则不能。…
leetcode.com 2026-10-26
🟡3619.count-islands-with-total-value-divisible-by-k
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #matrix
🟡3619.count-islands-with-total-value-divisible-by-k
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #matrix
Telegraph
count-islands-with-total-value-divisible-by-k
You are given an m x n matrix grid and a positive integer k. An island is a group of positive integers (representing land) that are 4-directionally connected (horizontally or vertically). The total value of an island is the sum of the values of all cells…
leetcode.cn 2026-10-28
🟡3882.minimum-xor-path-in-a-grid
🏷️ Tags
#bit_manipulation #array #dynamic_programming #matrix
🟡3882.minimum-xor-path-in-a-grid
🏷️ Tags
#bit_manipulation #array #dynamic_programming #matrix
Telegraph
minimum-xor-path-in-a-grid
给你一个大小为 m * n 的二维整数数组 grid。
leetcode.com 2026-10-28
🟡3882.minimum-xor-path-in-a-grid
🏷️ Tags
#bit_manipulation #array #dynamic_programming #matrix
🟡3882.minimum-xor-path-in-a-grid
🏷️ Tags
#bit_manipulation #array #dynamic_programming #matrix
Telegraph
minimum-xor-path-in-a-grid
You are given a 2D integer array grid of size m * n. You start at the top-left cell (0, 0) and want to reach the bottom-right cell (m - 1, n - 1). At each step, you may move either right or down. The cost of a path is defined as the bitwise XOR of all the…
leetcode.cn 2026-10-29
🔴3841.palindromic-path-queries-in-a-tree
🏷️ Tags
#bit_manipulation #tree #depth_first_search #binary_indexed_tree #segment_tree #array #string #divide_and_conquer
🔴3841.palindromic-path-queries-in-a-tree
🏷️ Tags
#bit_manipulation #tree #depth_first_search #binary_indexed_tree #segment_tree #array #string #divide_and_conquer
Telegraph
palindromic-path-queries-in-a-tree
给你一棵包含 n 个节点的无向树,节点编号从 0 到 n - 1。树由一个长度为 n - 1 的二维数组 edges 表示,其中 edges[i] = [ui, vi] 表示节点 ui 和 vi 之间存在一条无向边。
leetcode.com 2026-10-29
🔴3841.palindromic-path-queries-in-a-tree
🏷️ Tags
#bit_manipulation #tree #depth_first_search #binary_indexed_tree #segment_tree #array #string #divide_and_conquer
🔴3841.palindromic-path-queries-in-a-tree
🏷️ Tags
#bit_manipulation #tree #depth_first_search #binary_indexed_tree #segment_tree #array #string #divide_and_conquer
Telegraph
palindromic-path-queries-in-a-tree
You are given an undirected tree with n nodes labeled 0 to n - 1. This is represented by a 2D array edges of length n - 1, where edges[i] = [ui, vi] indicates an undirected edge between nodes ui and vi. You are also given a string s of length n consisting…