leetcode.cn 2023-05-08
🔴1263.minimum-moves-to-move-a-box-to-their-target-location
🏷️ Tags
#breadth_first_search #array #matrix #heap_priority_queue
🔴1263.minimum-moves-to-move-a-box-to-their-target-location
🏷️ Tags
#breadth_first_search #array #matrix #heap_priority_queue
Telegraph
minimum-moves-to-move-a-box-to-their-target-location
「推箱子」是一款风靡全球的益智小游戏,玩家需要将箱子推到仓库中的目标位置。 游戏地图用大小为 m x n 的网格 grid 表示,其中每个元素可以是墙、地板或者是箱子。 现在你将作为玩家参与游戏,按规则将箱子 'B' 移动到目标位置 'T' :
leetcode.cn 2023-05-13
🟢2441.largest-positive-integer-that-exists-with-its-negative
🏷️ Tags
#array #hash_table #two_pointers #sorting
🟢2441.largest-positive-integer-that-exists-with-its-negative
🏷️ Tags
#array #hash_table #two_pointers #sorting
Telegraph
largest-positive-integer-that-exists-with-its-negative
给你一个 不包含 任何零的整数数组 nums ,找出自身与对应的负数都在数组中存在的最大正整数 k 。 返回正整数 k ,如果不存在这样的整数,返回 -1 。 示例 1: 输入:nums = [-1,2,-3,3] 输出:3 解释:3 是数组中唯一一个满足题目要求的 k 。 示例 2: 输入:nums = [-1,10,6,7,-7,1] 输出:7 解释:数组中存在 1 和 7 对应的负数,7 的值更大。 示例 3: 输入:nums = [-10,8,6,7,-2,-3] 输出:-1 解释:不存在满足题目要求的…
leetcode.cn 2023-05-14
🟡1054.distant-barcodes
🏷️ Tags
#greedy #array #hash_table #counting #sorting #heap_priority_queue
🟡1054.distant-barcodes
🏷️ Tags
#greedy #array #hash_table #counting #sorting #heap_priority_queue
Telegraph
distant-barcodes
在一个仓库里,有一排条形码,其中第 i 个条形码为 barcodes[i]。 请你重新排列这些条形码,使其中任意两个相邻的条形码不能相等。 你可以返回任何满足该要求的答案,此题保证存在答案。 示例 1: 输入:barcodes = [1,1,1,2,2,2] 输出:[2,1,2,1,2,1] 示例 2: 输入:barcodes = [1,1,1,1,2,2,3,3] 输出:[1,3,1,3,2,1,2,1] 提示:
leetcode.com 2023-05-14
🔴1799.maximize-score-after-n-operations
🏷️ Tags
#bit_manipulation #array #math #dynamic_programming #backtracking #bitmask #number_theory
🔴1799.maximize-score-after-n-operations
🏷️ Tags
#bit_manipulation #array #math #dynamic_programming #backtracking #bitmask #number_theory
Telegraph
maximize-score-after-n-operations
You are given nums, an array of positive integers of size 2 * n. You must perform n operations on this array. In the ith operation (1-indexed), you will:
leetcode.cn 2023-05-15
🟡1072.flip-columns-for-maximum-number-of-equal-rows
🏷️ Tags
#array #hash_table #matrix
🟡1072.flip-columns-for-maximum-number-of-equal-rows
🏷️ Tags
#array #hash_table #matrix
Telegraph
flip-columns-for-maximum-number-of-equal-rows
给定 m x n 矩阵 matrix 。 你可以从中选出任意数量的列并翻转其上的 每个 单元格。(即翻转后,单元格的值从 0 变成 1,或者从 1 变为 0 。) 返回 经过一些翻转后,行与行之间所有值都相等的最大行数 。 示例 1: 输入:matrix = [[0,1],[1,1]] 输出:1 解释:不进行翻转,有 1 行所有值都相等。 示例 2: 输入:matrix = [[0,1],[1,0]] 输出:2 解释:翻转第一列的值之后,这两行都由相等的值组成。 示例 3: 输入:matrix = [[0…
leetcode.com 2023-05-17
🟡2130.maximum-twin-sum-of-a-linked-list
🏷️ Tags
#stack #linked_list #two_pointers
🟡2130.maximum-twin-sum-of-a-linked-list
🏷️ Tags
#stack #linked_list #two_pointers
Telegraph
maximum-twin-sum-of-a-linked-list
In a linked list of size n, where n is even, the ith node (0-indexed) of the linked list is known as the twin of the (n-1-i)th node, if 0 <= i <= (n / 2) - 1.