leetcode.com 2026-04-26
🟡1559.detect-cycles-in-2d-grid
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #matrix
🟡1559.detect-cycles-in-2d-grid
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #matrix
Telegraph
detect-cycles-in-2d-grid
Given a 2D array of characters grid of size m x n, you need to find if there exists any cycle consisting of the same value in grid. A cycle is a path of length 4 or more in the grid that starts and ends at the same cell. From a given cell, you can move to…
leetcode.cn 2026-04-27
🟡1391.check-if-there-is-a-valid-path-in-a-grid
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #matrix
🟡1391.check-if-there-is-a-valid-path-in-a-grid
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #matrix
Telegraph
check-if-there-is-a-valid-path-in-a-grid
给你一个 m x n 的网格 grid。网格里的每个单元都代表一条街道。grid[i][j] 的街道可以是:
leetcode.com 2026-04-27
🟡1391.check-if-there-is-a-valid-path-in-a-grid
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #matrix
🟡1391.check-if-there-is-a-valid-path-in-a-grid
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #matrix
Telegraph
check-if-there-is-a-valid-path-in-a-grid
You are given an m x n grid. Each cell of grid represents a street. The street of grid[i][j] can be:
leetcode.cn 2026-04-28
🟡2033.minimum-operations-to-make-a-uni-value-grid
🏷️ Tags
#array #math #matrix #sorting
🟡2033.minimum-operations-to-make-a-uni-value-grid
🏷️ Tags
#array #math #matrix #sorting
Telegraph
minimum-operations-to-make-a-uni-value-grid
给你一个大小为 m x n 的二维整数网格 grid 和一个整数 x 。每一次操作,你可以对 grid 中的任一元素 加 x 或 减 x 。 单值网格 是全部元素都相等的网格。 返回使网格化为单值网格所需的 最小 操作数。如果不能,返回 -1 。 示例 1: 输入:grid = [[2,4],[6,8]], x = 2 输出:4 解释:可以执行下述操作使所有元素都等于 4 : - 2 加 x 一次。 - 6 减 x 一次。 - 8 减 x 两次。 共计 4 次操作。 示例 2: 输入:grid = [[1…
leetcode.com 2026-04-28
🟡2033.minimum-operations-to-make-a-uni-value-grid
🏷️ Tags
#array #math #matrix #sorting
🟡2033.minimum-operations-to-make-a-uni-value-grid
🏷️ Tags
#array #math #matrix #sorting
Telegraph
minimum-operations-to-make-a-uni-value-grid
You are given a 2D integer grid of size m x n and an integer x. In one operation, you can add x to or subtract x from any element in the grid. A uni-value grid is a grid where all the elements of it are equal. Return the minimum number of operations to make…
leetcode.cn 2026-04-29
🔴3225.maximum-score-from-grid-operations
🏷️ Tags
#array #dynamic_programming #matrix #prefix_sum
🔴3225.maximum-score-from-grid-operations
🏷️ Tags
#array #dynamic_programming #matrix #prefix_sum
Telegraph
maximum-score-from-grid-operations
给你一个大小为 n x n 的二维矩阵 grid ,一开始所有格子都是白色的。一次操作中,你可以选择任意下标为 (i, j) 的格子,并将第 j 列中从最上面到第 i 行所有格子改成黑色。 如果格子 (i, j) 为白色,且左边或者右边的格子至少一个格子为黑色,那么我们将 grid[i][j] 加到最后网格图的总分中去。 请你返回执行任意次操作以后,最终网格图的 最大 总分数。 示例 1: 输入:grid = [[0,0,0,0,0],[0,0,3,0,0],[0,1,0,0,0],[5,0,0,3…
leetcode.com 2026-04-29
🔴3225.maximum-score-from-grid-operations
🏷️ Tags
#array #dynamic_programming #matrix #prefix_sum
🔴3225.maximum-score-from-grid-operations
🏷️ Tags
#array #dynamic_programming #matrix #prefix_sum
Telegraph
maximum-score-from-grid-operations
You are given a 2D matrix grid of size n x n. Initially, all cells of the grid are colored white. In one operation, you can select any cell of indices (i, j), and color black all the cells of the jth column starting from the top row down to the ith row. The…