leetcode.com 2026-02-25
🟢1356.sort-integers-by-the-number-of-1-bits
🏷️ Tags
#bit_manipulation #array #counting #sorting
🟢1356.sort-integers-by-the-number-of-1-bits
🏷️ Tags
#bit_manipulation #array #counting #sorting
Telegraph
sort-integers-by-the-number-of-1-bits
You are given an integer array arr. Sort the integers in the array in ascending order by the number of 1's in their binary representation and in case of two or more integers have the same number of 1's you have to sort them in ascending order. Return the…
leetcode.cn 2026-03-16
🟡1878.get-biggest-three-rhombus-sums-in-a-grid
🏷️ Tags
#array #math #matrix #prefix_sum #sorting #heap_priority_queue
🟡1878.get-biggest-three-rhombus-sums-in-a-grid
🏷️ Tags
#array #math #matrix #prefix_sum #sorting #heap_priority_queue
Telegraph
get-biggest-three-rhombus-sums-in-a-grid
给你一个 m x n 的整数矩阵 grid 。 菱形和 指的是 grid 中一个正菱形 边界 上的元素之和。本题中的菱形必须为正方形旋转45度,且四个角都在一个格子当中。下图是四个可行的菱形,每个菱形和应该包含的格子都用了相应颜色标注在图中。 注意,菱形可以是一个面积为 0 的区域,如上图中右下角的紫色菱形所示。 请你按照 降序 返回 grid 中三个最大的 互不相同的菱形和 。如果不同的和少于三个,则将它们全部返回。 示例 1: 输入:grid = [[3,4,5,1,3],[3,3,4,2,3]…
leetcode.com 2026-03-16
🟡1878.get-biggest-three-rhombus-sums-in-a-grid
🏷️ Tags
#array #math #matrix #prefix_sum #sorting #heap_priority_queue
🟡1878.get-biggest-three-rhombus-sums-in-a-grid
🏷️ Tags
#array #math #matrix #prefix_sum #sorting #heap_priority_queue
Telegraph
get-biggest-three-rhombus-sums-in-a-grid
You are given an m x n integer matrix grid. A rhombus sum is the sum of the elements that form the border of a regular rhombus shape in grid. The rhombus must have the shape of a square rotated 45 degrees with each of the corners centered in a grid…
leetcode.cn 2026-03-17
🟡1727.largest-submatrix-with-rearrangements
🏷️ Tags
#greedy #array #matrix #sorting
🟡1727.largest-submatrix-with-rearrangements
🏷️ Tags
#greedy #array #matrix #sorting
Telegraph
largest-submatrix-with-rearrangements
给你一个二进制矩阵 matrix ,它的大小为 m x n ,你可以将 matrix 中的 列 按任意顺序重新排列。 请你返回最优方案下将 matrix 重新排列后,全是 1 的子矩阵面积。 示例 1: 输入:matrix = [[0,0,1],[1,1,1],[1,0,1]] 输出:4 解释:你可以按照上图方式重新排列矩阵的每一列。 最大的全 1 子矩阵是上图中加粗的部分,面积为 4 。 示例 2: 输入:matrix = [[1,0,1,0,1]] 输出:3 解释:你可以按照上图方式重新排列矩阵的每一列。…
leetcode.com 2026-03-17
🟡1727.largest-submatrix-with-rearrangements
🏷️ Tags
#greedy #array #matrix #sorting
🟡1727.largest-submatrix-with-rearrangements
🏷️ Tags
#greedy #array #matrix #sorting
Telegraph
largest-submatrix-with-rearrangements
You are given a binary matrix matrix of size m x n, and you are allowed to rearrange the columns of the matrix in any order. Return the area of the largest submatrix within matrix where every element of the submatrix is 1 after reordering the columns optimally.…
leetcode.cn 2026-03-20
🟡3567.minimum-absolute-difference-in-sliding-submatrix
🏷️ Tags
#array #matrix #sorting
🟡3567.minimum-absolute-difference-in-sliding-submatrix
🏷️ Tags
#array #matrix #sorting
Telegraph
minimum-absolute-difference-in-sliding-submatrix
给你一个 m x n 的整数矩阵 grid 和一个整数 k。 对于矩阵 grid 中的每个连续的 k x k 子矩阵,计算其中任意两个 不同值 之间的 最小绝对差 。 返回一个大小为 (m - k + 1) x (n - k + 1) 的二维数组 ans,其中 ans[i][j] 表示以 grid 中坐标 (i, j) 为左上角的子矩阵的最小绝对差。 注意:如果子矩阵中的所有元素都相同,则答案为 0。 子矩阵 (x1, y1, x2, y2) 是一个由选择矩阵中所有满足 x1 <= x <= x2 且 y1…
leetcode.com 2026-03-20
🟡3567.minimum-absolute-difference-in-sliding-submatrix
🏷️ Tags
#array #matrix #sorting
🟡3567.minimum-absolute-difference-in-sliding-submatrix
🏷️ Tags
#array #matrix #sorting
Telegraph
minimum-absolute-difference-in-sliding-submatrix
You are given an m x n integer matrix grid and an integer k. For every contiguous k x k submatrix of grid, compute the minimum absolute difference between any two distinct values within that submatrix. Return a 2D array ans of size (m - k + 1) x (n - k +…
leetcode.cn 2026-03-30
🟡2840.check-if-strings-can-be-made-equal-with-operations-ii
🏷️ Tags
#hash_table #string #sorting
🟡2840.check-if-strings-can-be-made-equal-with-operations-ii
🏷️ Tags
#hash_table #string #sorting
Telegraph
check-if-strings-can-be-made-equal-with-operations-ii
给你两个字符串 s1 和 s2 ,两个字符串长度都为 n ,且只包含 小写 英文字母。 你可以对两个字符串中的 任意一个 执行以下操作 任意 次:
leetcode.com 2026-03-30
🟡2840.check-if-strings-can-be-made-equal-with-operations-ii
🏷️ Tags
#hash_table #string #sorting
🟡2840.check-if-strings-can-be-made-equal-with-operations-ii
🏷️ Tags
#hash_table #string #sorting
Telegraph
check-if-strings-can-be-made-equal-with-operations-ii
You are given two strings s1 and s2, both of length n, consisting of lowercase English letters. You can apply the following operation on any of the two strings any number of times:
leetcode.cn 2026-04-03
🔴3661.maximum-walls-destroyed-by-robots
🏷️ Tags
#array #binary_search #dynamic_programming #sorting
🔴3661.maximum-walls-destroyed-by-robots
🏷️ Tags
#array #binary_search #dynamic_programming #sorting
Telegraph
maximum-walls-destroyed-by-robots
robots[i] 是第 i 个机器人的位置。
leetcode.com 2026-04-03
🔴3661.maximum-walls-destroyed-by-robots
🏷️ Tags
#array #binary_search #dynamic_programming #sorting
🔴3661.maximum-walls-destroyed-by-robots
🏷️ Tags
#array #binary_search #dynamic_programming #sorting
Telegraph
maximum-walls-destroyed-by-robots
robots[i] is the position of the ith robot.
leetcode.cn 2026-04-14
🔴2463.minimum-total-distance-traveled
🏷️ Tags
#array #dynamic_programming #sorting
🔴2463.minimum-total-distance-traveled
🏷️ Tags
#array #dynamic_programming #sorting
Telegraph
minimum-total-distance-traveled
X 轴上有一些机器人和工厂。给你一个整数数组 robot ,其中 robot[i] 是第 i 个机器人的位置。再给你一个二维整数数组 factory ,其中 factory[j] = [positionj, limitj] ,表示第 j 个工厂的位置在 positionj ,且第 j 个工厂最多可以修理 limitj 个机器人。 每个机器人所在的位置 互不相同 。每个工厂所在的位置也 互不相同 。注意一个机器人可能一开始跟一个工厂在 相同的位置 。 所有机器人一开始都是坏的,他们会沿着设定的方向一直移动。设定的方向要么是…
leetcode.com 2026-04-14
🔴2463.minimum-total-distance-traveled
🏷️ Tags
#array #dynamic_programming #sorting
🔴2463.minimum-total-distance-traveled
🏷️ Tags
#array #dynamic_programming #sorting
Telegraph
minimum-total-distance-traveled
There are some robots and factories on the X-axis. You are given an integer array robot where robot[i] is the position of the ith robot. You are also given a 2D integer array factory where factory[j] = [positionj, limitj] indicates that positionj is the position…
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-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…