leetcode.cn 2023-05-07
🟡1010.pairs-of-songs-with-total-durations-divisible-by-60
🏷️ Tags
#array #hash_table #counting
🟡1010.pairs-of-songs-with-total-durations-divisible-by-60
🏷️ Tags
#array #hash_table #counting
Telegraph
pairs-of-songs-with-total-durations-divisible-by-60
在歌曲列表中,第 i 首歌曲的持续时间为 time[i] 秒。 返回其总持续时间(以秒为单位)可被 60 整除的歌曲对的数量。形式上,我们希望下标数字 i 和 j 满足 i < j 且有 (time[i] + time[j]) % 60 == 0。 示例 1: 输入:time = [30,20,150,100,40] 输出:3 解释:这三对的总持续时间可被 60 整除: (time[0] = 30, time[2] = 150): 总持续时间 180 (time[1] = 20, time[3] =…
leetcode.com 2023-05-07
🔴1964.find-the-longest-valid-obstacle-course-at-each-position
🏷️ Tags
#binary_indexed_tree #array #binary_search
🔴1964.find-the-longest-valid-obstacle-course-at-each-position
🏷️ Tags
#binary_indexed_tree #array #binary_search
Telegraph
find-the-longest-valid-obstacle-course-at-each-position
You want to build some obstacle courses. You are given a 0-indexed integer array obstacles of length n, where obstacles[i] describes the height of the ith obstacle. For every index i between 0 and n - 1 (inclusive), find the length of the longest obstacle…
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…