leetcode.com 2026-04-17
🟡3761.minimum-absolute-distance-between-mirror-pairs
🏷️ Tags
#array #hash_table #math
🟡3761.minimum-absolute-distance-between-mirror-pairs
🏷️ Tags
#array #hash_table #math
Telegraph
minimum-absolute-distance-between-mirror-pairs
You are given an integer array nums. A mirror pair is a pair of indices (i, j) such that:
leetcode.cn 2026-04-19
🟡1855.maximum-distance-between-a-pair-of-values
🏷️ Tags
#array #two_pointers #binary_search
🟡1855.maximum-distance-between-a-pair-of-values
🏷️ Tags
#array #two_pointers #binary_search
Telegraph
maximum-distance-between-a-pair-of-values
给你两个 非递增 的整数数组 nums1 和 nums2 ,数组下标均 从 0 开始 计数。 下标对 (i, j) 中 0 <= i < nums1.length 且 0 <= j < nums2.length 。如果该下标对同时满足 i <= j 且 nums1[i] <= nums2[j] ,则称之为 有效 下标对,该下标对的 距离 为 j - i 。 返回所有 有效 下标对 (i, j) 中的 最大距离 。如果不存在有效下标对,返回 0 。 一个数组 arr ,如果每个…
leetcode.com 2026-04-19
🟡1855.maximum-distance-between-a-pair-of-values
🏷️ Tags
#array #two_pointers #binary_search
🟡1855.maximum-distance-between-a-pair-of-values
🏷️ Tags
#array #two_pointers #binary_search
Telegraph
maximum-distance-between-a-pair-of-values
You are given two non-increasing 0-indexed integer arrays nums1 and nums2. A pair of indices (i, j), where 0 <= i < nums1.length and 0 <= j < nums2.length, is valid if both i <= j and nums1[i] <= nums2[j]. The distance of the pair is j - i.…
leetcode.cn 2026-04-21
🟡1722.minimize-hamming-distance-after-swap-operations
🏷️ Tags
#depth_first_search #union_find #array
🟡1722.minimize-hamming-distance-after-swap-operations
🏷️ Tags
#depth_first_search #union_find #array
Telegraph
minimize-hamming-distance-after-swap-operations
给你两个整数数组 source 和 target ,长度都是 n 。还有一个数组 allowedSwaps ,其中每个 allowedSwaps[i] = [ai, bi] 表示你可以交换数组 source 中下标为 ai 和 bi(下标从 0 开始)的两个元素。注意,你可以按 任意 顺序 多次 交换一对特定下标指向的元素。 相同长度的两个数组 source 和 target 间的 汉明距离 是元素不同的下标数量。形式上,其值等于满足 source[i] != target[i] (下标从 0 开始)的下标…
leetcode.com 2026-04-21
🟡1722.minimize-hamming-distance-after-swap-operations
🏷️ Tags
#depth_first_search #union_find #array
🟡1722.minimize-hamming-distance-after-swap-operations
🏷️ Tags
#depth_first_search #union_find #array
Telegraph
minimize-hamming-distance-after-swap-operations
You are given two integer arrays, source and target, both of length n. You are also given an array allowedSwaps where each allowedSwaps[i] = [ai, bi] indicates that you are allowed to swap the elements at index ai and index bi (0-indexed) of array source.…
leetcode.cn 2026-04-25
🔴3464.maximize-the-distance-between-points-on-a-square
🏷️ Tags
#geometry #array #math #binary_search #sorting
🔴3464.maximize-the-distance-between-points-on-a-square
🏷️ Tags
#geometry #array #math #binary_search #sorting
Telegraph
maximize-the-distance-between-points-on-a-square
给你一个整数 side,表示一个正方形的边长,正方形的四个角分别位于笛卡尔平面的 (0, 0) ,(0, side) ,(side, 0) 和 (side, side) 处。
leetcode.com 2026-04-25
🔴3464.maximize-the-distance-between-points-on-a-square
🏷️ Tags
#geometry #array #math #binary_search #sorting
🔴3464.maximize-the-distance-between-points-on-a-square
🏷️ Tags
#geometry #array #math #binary_search #sorting
Telegraph
maximize-the-distance-between-points-on-a-square
You are given an integer side, representing the edge length of a square with corners at (0, 0), (0, side), (side, 0), and (side, side) on a Cartesian plane. You are also given a positive integer k and a 2D integer array points, where points[i] = [xi, yi]…
leetcode.cn 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
给你一个二维字符网格数组 grid ,大小为 m x n ,你需要检查 grid 中是否存在 相同值 形成的环。 一个环是一条开始和结束于同一个格子的长度 大于等于 4 的路径。对于一个给定的格子,你可以移动到它上、下、左、右四个方向相邻的格子之一,可以移动的前提是这两个格子有 相同的值 。 同时,你也不能回到上一次移动时所在的格子。比方说,环 (1, 1) -> (1, 2) -> (1, 1) 是不合法的,因为从 (1, 2) 移动到 (1, 1) 回到了上一次移动时的格子。 如果 grid 中有相同值形成的环,请你返回…
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: