leetcode.com 2026-07-24
🟡3514.number-of-unique-xor-triplets-ii
🏷️ Tags
#bit_manipulation #array #math #enumeration
🟡3514.number-of-unique-xor-triplets-ii
🏷️ Tags
#bit_manipulation #array #math #enumeration
Telegraph
number-of-unique-xor-triplets-ii
You are given an integer array nums. A XOR triplet is defined as the XOR of three elements nums[i] XOR nums[j] XOR nums[k] where i <= j <= k. Return the number of unique XOR triplet values from all possible triplets (i, j, k). Example 1: Input: nums = [1…
leetcode.cn 2026-07-27
🟢1464.maximum-product-of-two-elements-in-an-array
🏷️ Tags
#array #sorting #heap_priority_queue
🟢1464.maximum-product-of-two-elements-in-an-array
🏷️ Tags
#array #sorting #heap_priority_queue
Telegraph
maximum-product-of-two-elements-in-an-array
给你一个整数数组 nums,请你选择数组的两个不同下标 i 和 j,使 (nums[i]-1)*(nums[j]-1) 取得最大值。 请你计算并返回该式的最大值。 示例 1: 输入:nums = [3,4,5,2] 输出:12 解释:如果选择下标 i=1 和 j=2(下标从 0 开始),则可以获得最大值,(nums[1]-1)*(nums[2]-1) = (4-1)*(5-1) = 3*4 = 12 。 示例 2: 输入:nums = [1,5,4,5] 输出:16 解释:选择下标 i=1 和 j=3(下标从…
leetcode.com 2026-07-27
🟢1464.maximum-product-of-two-elements-in-an-array
🏷️ Tags
#array #sorting #heap_priority_queue
🟢1464.maximum-product-of-two-elements-in-an-array
🏷️ Tags
#array #sorting #heap_priority_queue
Telegraph
maximum-product-of-two-elements-in-an-array
Example 1: Input: nums = [3,4,5,2] Output: 12 Explanation: If you choose the indices i=1 and j=2 (indexed from 0), you will get the maximum value, that is, (nums[1]-1)*(nums[2]-1) = (4-1)*(5-1) = 3*4 = 12. Example 2: Input: nums = [1,5,4,5] Output: 16 Explanation:…
leetcode.cn 2026-08-01
🟡486.predict-the-winner
🏷️ Tags
#recursion #array #math #dynamic_programming #game_theory
🟡486.predict-the-winner
🏷️ Tags
#recursion #array #math #dynamic_programming #game_theory
Telegraph
predict-the-winner
给你一个整数数组 nums 。玩家 1 和玩家 2 基于这个数组设计了一个游戏。 玩家 1 和玩家 2 轮流进行自己的回合,玩家 1 先手。开始时,两个玩家的初始分值都是 0 。每一回合,玩家从数组的任意一端取一个数字(即,nums[0] 或 nums[nums.length - 1]),取到的数字将会从数组中移除(数组长度减 1 )。玩家选中的数字将会加到他的得分上。当数组中没有剩余数字可取时,游戏结束。 如果玩家 1 能成为赢家,返回 true 。如果两个玩家得分相等,同样认为玩家 1 是游戏的赢家,也返回…
leetcode.com 2026-08-01
🟡486.predict-the-winner
🏷️ Tags
#recursion #array #math #dynamic_programming #game_theory
🟡486.predict-the-winner
🏷️ Tags
#recursion #array #math #dynamic_programming #game_theory
Telegraph
predict-the-winner
You are given an integer array nums. Two players are playing a game with this array: player 1 and player 2. Player 1 and player 2 take turns, with player 1 starting first. Both players start the game with a score of 0. At each turn, the player takes one of…
leetcode.com 2026-08-03
🔴1406.stone-game-iii
🏷️ Tags
#minimax_algorithm #array #math #dynamic_programming #game_theory #zero_sum_game
🔴1406.stone-game-iii
🏷️ Tags
#minimax_algorithm #array #math #dynamic_programming #game_theory #zero_sum_game
Telegraph
stone-game-iii
Alice and Bob continue their games with piles of stones. There are several stones arranged in a row, and each stone has an associated value which is an integer given in the array stoneValue. Alice and Bob take turns, with Alice starting first. On each player's…
leetcode.cn 2026-08-09
🟡1140.stone-game-ii
🏷️ Tags
#minimax_algorithm #array #math #dynamic_programming #game_theory #prefix_sum #zero_sum_game
🟡1140.stone-game-ii
🏷️ Tags
#minimax_algorithm #array #math #dynamic_programming #game_theory #prefix_sum #zero_sum_game
Telegraph
stone-game-ii
Alice 和 Bob 继续他们的石子游戏。许多堆石子 排成一行,每堆都有正整数颗石子 piles[i]。游戏以谁手中的石子最多来决出胜负。 Alice 和 Bob 轮流进行,Alice 先开始。最初,M = 1。 在每个玩家的回合中,该玩家可以拿走剩下的 前 X 堆的所有石子,其中 1 <= X <= 2M。然后,令 M = max(M, X)。 游戏一直持续到所有石子都被拿走。 假设 Alice 和 Bob 都发挥出最佳水平,返回 Alice 可以得到的最大数量的石头。 示例 1: 输入:piles…
leetcode.com 2026-08-09
🟡1140.stone-game-ii
🏷️ Tags
#minimax_algorithm #array #math #dynamic_programming #game_theory #prefix_sum #zero_sum_game
🟡1140.stone-game-ii
🏷️ Tags
#minimax_algorithm #array #math #dynamic_programming #game_theory #prefix_sum #zero_sum_game
Telegraph
stone-game-ii
Alice and Bob continue their games with piles of stones. There are a number of piles arranged in a row, and each pile has a positive integer number of stones piles[i]. The objective of the game is to end with the most stones. Alice and Bob take turns, with…
leetcode.cn 2026-08-11
🟢2996.smallest-missing-integer-greater-than-sequential-prefix-sum
🏷️ Tags
#array #hash_table #sorting
🟢2996.smallest-missing-integer-greater-than-sequential-prefix-sum
🏷️ Tags
#array #hash_table #sorting
Telegraph
smallest-missing-integer-greater-than-sequential-prefix-sum
给你一个下标从 0 开始的整数数组 nums 。 如果一个前缀 nums[0..i] 满足对于 1 <= j <= i 的所有元素都有 nums[j] = nums[j - 1] + 1 ,那么我们称这个前缀是一个 顺序前缀 。特殊情况是,只包含 nums[0] 的前缀也是一个 顺序前缀 。 请你返回 nums 中没有出现过的 最小 整数 x ,满足 x 大于等于 最长 顺序前缀的和。 示例 1: 输入:nums = [1,2,3,2,5] 输出:6 解释:nums 的最长顺序前缀是 [1,2,3]…
leetcode.com 2026-08-11
🟢2996.smallest-missing-integer-greater-than-sequential-prefix-sum
🏷️ Tags
#array #hash_table #sorting
🟢2996.smallest-missing-integer-greater-than-sequential-prefix-sum
🏷️ Tags
#array #hash_table #sorting
Telegraph
smallest-missing-integer-greater-than-sequential-prefix-sum
You are given a 0-indexed array of integers nums. A prefix nums[0..i] is sequential if, for all 1 <= j <= i, nums[j] = nums[j - 1] + 1. In particular, the prefix consisting only of nums[0] is sequential. Return the smallest integer x missing from nums such…
leetcode.cn 2026-08-12
🟡2958.length-of-longest-subarray-with-at-most-k-frequency
🏷️ Tags
#array #hash_table #sliding_window
🟡2958.length-of-longest-subarray-with-at-most-k-frequency
🏷️ Tags
#array #hash_table #sliding_window
Telegraph
length-of-longest-subarray-with-at-most-k-frequency
给你一个整数数组 nums 和一个整数 k 。 一个元素 x 在数组中的 频率 指的是它在数组中的出现次数。 如果一个数组中所有元素的频率都 小于等于 k ,那么我们称这个数组是 好 数组。 请你返回 nums 中 最长好 子数组的长度。 子数组 指的是一个数组中一段连续非空的元素序列。 示例 1: 输入:nums = [1,2,3,1,2,3,1,2], k = 2 输出:6 解释:最长好子数组是 [1,2,3,1,2,3] ,值 1 ,2 和 3 在子数组中的频率都没有超过 k = 2 。[2,3…
leetcode.com 2026-08-12
🟡2958.length-of-longest-subarray-with-at-most-k-frequency
🏷️ Tags
#array #hash_table #sliding_window
🟡2958.length-of-longest-subarray-with-at-most-k-frequency
🏷️ Tags
#array #hash_table #sliding_window
Telegraph
length-of-longest-subarray-with-at-most-k-frequency
You are given an integer array nums and an integer k. The frequency of an element x is the number of times it occurs in an array. An array is called good if the frequency of each element in this array is less than or equal to k. Return the length of the longest…
leetcode.cn 2026-08-13
🔴2213.longest-substring-of-one-repeating-character
🏷️ Tags
#segment_tree #array #string #ordered_set
🔴2213.longest-substring-of-one-repeating-character
🏷️ Tags
#segment_tree #array #string #ordered_set
Telegraph
longest-substring-of-one-repeating-character
给你一个下标从 0 开始的字符串 s 。另给你一个下标从 0 开始、长度为 k 的字符串 queryCharacters ,一个下标从 0 开始、长度也是 k 的整数 下标 数组 queryIndices ,这两个都用来描述 k 个查询。 第 i 个查询会将 s 中位于下标 queryIndices[i] 的字符更新为 queryCharacters[i] 。 返回一个长度为 k 的数组 lengths ,其中 lengths[i] 是在执行第 i 个查询 之后 s 中仅由 单个字符重复 组成的 最长子字符串…