leetcode.cn 2025-06-04
🟡3403.find-the-lexicographically-largest-string-from-the-box-i
🏷️ Tags
#two_pointers #string #enumeration
🟡3403.find-the-lexicographically-largest-string-from-the-box-i
🏷️ Tags
#two_pointers #string #enumeration
Telegraph
find-the-lexicographically-largest-string-from-the-box-i
给你一个字符串 word 和一个整数 numFriends。 Alice 正在为她的 numFriends 位朋友组织一个游戏。游戏分为多个回合,在每一回合中:
leetcode.com 2025-06-04
🟡3403.find-the-lexicographically-largest-string-from-the-box-i
🏷️ Tags
#two_pointers #string #enumeration
🟡3403.find-the-lexicographically-largest-string-from-the-box-i
🏷️ Tags
#two_pointers #string #enumeration
Telegraph
find-the-lexicographically-largest-string-from-the-box-i
You are given a string word, and an integer numFriends. Alice is organizing a game for her numFriends friends. There are multiple rounds in the game, where in each round:
leetcode.cn 2025-06-29
🟡1498.number-of-subsequences-that-satisfy-the-given-sum-condition
🏷️ Tags
#array #two_pointers #binary_search #sorting
🟡1498.number-of-subsequences-that-satisfy-the-given-sum-condition
🏷️ Tags
#array #two_pointers #binary_search #sorting
Telegraph
number-of-subsequences-that-satisfy-the-given-sum-condition
给你一个整数数组 nums 和一个整数 target 。 请你统计并返回 nums 中能满足其最小元素与最大元素的 和 小于或等于 target 的 非空 子序列的数目。 由于答案可能很大,请将结果对 109 + 7 取余后返回。 示例 1: 输入:nums = [3,5,6,7], target = 9 输出:4 解释:有 4 个子序列满足该条件。 [3] -> 最小元素 + 最大元素 <= target (3 + 3 <= 9) [3,5] -> (3 + 5 <= 9) [3,5,6] -> (3…
leetcode.com 2025-06-29
🟡1498.number-of-subsequences-that-satisfy-the-given-sum-condition
🏷️ Tags
#array #two_pointers #binary_search #sorting
🟡1498.number-of-subsequences-that-satisfy-the-given-sum-condition
🏷️ Tags
#array #two_pointers #binary_search #sorting
Telegraph
number-of-subsequences-that-satisfy-the-given-sum-condition
You are given an array of integers nums and an integer target. Return the number of non-empty subsequences of nums such that the sum of the minimum and maximum element on it is less or equal to target. Since the answer may be too large, return it modulo 109…
leetcode.cn 2025-07-13
🟡2410.maximum-matching-of-players-with-trainers
🏷️ Tags
#greedy #array #two_pointers #sorting
🟡2410.maximum-matching-of-players-with-trainers
🏷️ Tags
#greedy #array #two_pointers #sorting
Telegraph
maximum-matching-of-players-with-trainers
给你一个下标从 0 开始的整数数组 players ,其中 players[i] 表示第 i 名运动员的 能力 值,同时给你一个下标从 0 开始的整数数组 trainers ,其中 trainers[j] 表示第 j 名训练师的 训练能力值 。 如果第 i 名运动员的能力值 小于等于 第 j 名训练师的能力值,那么第 i 名运动员可以 匹配 第 j 名训练师。除此以外,每名运动员至多可以匹配一位训练师,每位训练师最多可以匹配一位运动员。 请你返回满足上述要求 players 和 trainers 的 最大…
leetcode.com 2025-07-13
🟡2410.maximum-matching-of-players-with-trainers
🏷️ Tags
#greedy #array #two_pointers #sorting
🟡2410.maximum-matching-of-players-with-trainers
🏷️ Tags
#greedy #array #two_pointers #sorting
Telegraph
maximum-matching-of-players-with-trainers
You are given a 0-indexed integer array players, where players[i] represents the ability of the ith player. You are also given a 0-indexed integer array trainers, where trainers[j] represents the training capacity of the jth trainer. The ith player can match…
leetcode.cn 2025-09-26
🟡611.valid-triangle-number
🏷️ Tags
#greedy #array #two_pointers #binary_search #sorting
🟡611.valid-triangle-number
🏷️ Tags
#greedy #array #two_pointers #binary_search #sorting
Telegraph
valid-triangle-number
给定一个包含非负整数的数组 nums ,返回其中可以组成三角形三条边的三元组个数。 示例 1: 输入: nums = [2,2,3,4] 输出: 3 解释:有效的组合是: 2,3,4 (使用第一个 2) 2,3,4 (使用第二个 2) 2,2,3 示例 2: 输入: nums = [4,2,3,4] 输出: 4 提示:
leetcode.com 2025-09-26
🟡611.valid-triangle-number
🏷️ Tags
#greedy #array #two_pointers #binary_search #sorting
🟡611.valid-triangle-number
🏷️ Tags
#greedy #array #two_pointers #binary_search #sorting
Telegraph
valid-triangle-number
Given an integer array nums, return the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle. Example 1: Input: nums = [2,2,3,4] Output: 3 Explanation: Valid combinations are: 2,3,4 (using the first…
leetcode.cn 2025-10-08
🟡2300.successful-pairs-of-spells-and-potions
🏷️ Tags
#array #two_pointers #binary_search #sorting
🟡2300.successful-pairs-of-spells-and-potions
🏷️ Tags
#array #two_pointers #binary_search #sorting
Telegraph
successful-pairs-of-spells-and-potions
给你两个正整数数组 spells 和 potions ,长度分别为 n 和 m ,其中 spells[i] 表示第 i 个咒语的能量强度,potions[j] 表示第 j 瓶药水的能量强度。 同时给你一个整数 success 。一个咒语和药水的能量强度 相乘 如果 大于等于 success ,那么它们视为一对 成功 的组合。 请你返回一个长度为 n 的整数数组 pairs,其中 pairs[i] 是能跟第 i 个咒语成功组合的 药水 数目。 示例 1: 输入:spells = [5,1,3], potions…
leetcode.com 2025-10-08
🟡2300.successful-pairs-of-spells-and-potions
🏷️ Tags
#array #two_pointers #binary_search #sorting
🟡2300.successful-pairs-of-spells-and-potions
🏷️ Tags
#array #two_pointers #binary_search #sorting
Telegraph
successful-pairs-of-spells-and-potions
You are given two positive integer arrays spells and potions, of length n and m respectively, where spells[i] represents the strength of the ith spell and potions[j] represents the strength of the jth potion. You are also given an integer success. A spell…
leetcode.cn 2025-10-11
🟡3186.maximum-total-damage-with-spell-casting
🏷️ Tags
#array #hash_table #two_pointers #binary_search #dynamic_programming #counting #sorting
🟡3186.maximum-total-damage-with-spell-casting
🏷️ Tags
#array #hash_table #two_pointers #binary_search #dynamic_programming #counting #sorting
Telegraph
maximum-total-damage-with-spell-casting
一个魔法师有许多不同的咒语。 给你一个数组 power ,其中每个元素表示一个咒语的伤害值,可能会有多个咒语有相同的伤害值。 已知魔法师使用伤害值为 power[i] 的咒语时,他们就 不能 使用伤害为 power[i] - 2 ,power[i] - 1 ,power[i] + 1 或者 power[i] + 2 的咒语。 每个咒语最多只能被使用 一次 。 请你返回这个魔法师可以达到的伤害值之和的 最大值 。 示例 1: 输入:power = [1,1,3,4] 输出:6 解释: 可以使用咒语 0,1,3,伤害值分别为…
leetcode.com 2025-10-11
🟡3186.maximum-total-damage-with-spell-casting
🏷️ Tags
#array #hash_table #two_pointers #binary_search #dynamic_programming #counting #sorting
🟡3186.maximum-total-damage-with-spell-casting
🏷️ Tags
#array #hash_table #two_pointers #binary_search #dynamic_programming #counting #sorting
Telegraph
maximum-total-damage-with-spell-casting
A magician has various spells. You are given an array power, where each element represents the damage of a spell. Multiple spells can have the same damage value. It is a known fact that if a magician decides to cast a spell with a damage of power[i], they…