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.
leetcode.cn 2023-05-19
🟡1079.letter-tile-possibilities
🏷️ Tags
#hash_table #string #backtracking #counting
🟡1079.letter-tile-possibilities
🏷️ Tags
#hash_table #string #backtracking #counting
Telegraph
letter-tile-possibilities
你有一套活字字模 tiles,其中每个字模上都刻有一个字母 tiles[i]。返回你可以印出的非空字母序列的数目。 注意:本题中,每个活字字模只能使用一次。 示例 1: 输入:"AAB" 输出:8 解释:可能的序列为 "A", "B", "AA", "AB", "BA", "AAB", "ABA", "BAA"。 示例 2: 输入:"AAABBC" 输出:188 示例 3: 输入:"V" 输出:1 提示:
leetcode.com 2023-05-19
🟡785.is-graph-bipartite
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #graph
🟡785.is-graph-bipartite
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #graph
Telegraph
is-graph-bipartite
There is an undirected graph with n nodes, where each node is numbered between 0 and n - 1. You are given a 2D array graph, where graph[u] is an array of nodes that node u is adjacent to. More formally, for each v in graph[u], there is an undirected edge…