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…
leetcode.cn 2026-11-04
🔴3505.minimum-operations-to-make-elements-within-k-subarrays-equal
🏷️ Tags
#array #hash_table #math #dynamic_programming #sliding_window #heap_priority_queue
🔴3505.minimum-operations-to-make-elements-within-k-subarrays-equal
🏷️ Tags
#array #hash_table #math #dynamic_programming #sliding_window #heap_priority_queue
Telegraph
minimum-operations-to-make-elements-within-k-subarrays-equal
给你一个整数数组 nums 和两个整数 x 和 k。你可以执行以下操作任意次(包括零次):
leetcode.com 2026-11-04
🔴3505.minimum-operations-to-make-elements-within-k-subarrays-equal
🏷️ Tags
#array #hash_table #math #dynamic_programming #sliding_window #heap_priority_queue
🔴3505.minimum-operations-to-make-elements-within-k-subarrays-equal
🏷️ Tags
#array #hash_table #math #dynamic_programming #sliding_window #heap_priority_queue
Telegraph
minimum-operations-to-make-elements-within-k-subarrays-equal
You are given an integer array nums and two integers, x and k. You can perform the following operation any number of times (including zero):
leetcode.cn 2026-11-05
🟢1385.find-the-distance-value-between-two-arrays
🏷️ Tags
#array #two_pointers #binary_search #sorting
🟢1385.find-the-distance-value-between-two-arrays
🏷️ Tags
#array #two_pointers #binary_search #sorting
Telegraph
find-the-distance-value-between-two-arrays
给你两个整数数组 arr1 , arr2 和一个整数 d ,请你返回两个数组之间的 距离值 。 「距离值」 定义为符合此距离要求的元素数目:对于元素 arr1[i] ,不存在任何元素 arr2[j] 满足 |arr1[i]-arr2[j]| <= d 。 示例 1: 输入:arr1 = [4,5,8], arr2 = [10,9,1,8], d = 2 输出:2 解释: 对于 arr1[0]=4 我们有: |4-10|=6 > d=2 |4-9|=5 > d=2 |4-1|=3 > d=2 |4-8|=4…
leetcode.com 2026-11-05
🟢1385.find-the-distance-value-between-two-arrays
🏷️ Tags
#array #two_pointers #binary_search #sorting
🟢1385.find-the-distance-value-between-two-arrays
🏷️ Tags
#array #two_pointers #binary_search #sorting
Telegraph
find-the-distance-value-between-two-arrays
Given two integer arrays arr1 and arr2, and the integer d, return the distance value between the two arrays. The distance value is defined as the number of elements arr1[i] such that there is not any element arr2[j] where |arr1[i]-arr2[j]| <= d. Example…