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-07-28
🟡3517.smallest-palindromic-rearrangement-i
🏷️ Tags
#string #counting_sort #sorting
🟡3517.smallest-palindromic-rearrangement-i
🏷️ Tags
#string #counting_sort #sorting
Telegraph
smallest-palindromic-rearrangement-i
给你一个 回文 字符串 s。 返回 s 的按字典序排列的 最小 回文排列。 如果一个字符串从前往后和从后往前读都相同,那么这个字符串是一个 回文 字符串。 排列 是字符串中所有字符的重排。
leetcode.com 2026-07-28
🟡3517.smallest-palindromic-rearrangement-i
🏷️ Tags
#string #counting_sort #sorting
🟡3517.smallest-palindromic-rearrangement-i
🏷️ Tags
#string #counting_sort #sorting
Telegraph
smallest-palindromic-rearrangement-i
You are given a palindromic string s. Return the lexicographically smallest palindromic permutation of s. Example 1: Input: s = "z" Output: "z" Explanation: A string of only one character is already the lexicographically smallest palindrome. Example 2:…
leetcode.cn 2026-07-31
🟡3016.minimum-number-of-pushes-to-type-word-ii
🏷️ Tags
#greedy #hash_table #string #counting #sorting
🟡3016.minimum-number-of-pushes-to-type-word-ii
🏷️ Tags
#greedy #hash_table #string #counting #sorting
Telegraph
minimum-number-of-pushes-to-type-word-ii
给你一个字符串 word,由小写英文字母组成。 电话键盘上的按键与 不同 小写英文字母集合相映射,可以通过按压按键来组成单词。例如,按键 2 对应 ["a","b","c"],我们需要按一次键来输入 "a",按两次键来输入 "b",按三次键来输入 "c"。 现在允许你将编号为 2 到 9 的按键重新映射到 不同 字母集合。每个按键可以映射到 任意数量 的字母,但每个字母 必须 恰好 映射到 一个 按键上。你需要找到输入字符串 word 所需的 最少 按键次数。 返回重新映射按键后输入 word 所需的 最少…
leetcode.com 2026-07-31
🟡3016.minimum-number-of-pushes-to-type-word-ii
🏷️ Tags
#greedy #hash_table #string #counting #sorting
🟡3016.minimum-number-of-pushes-to-type-word-ii
🏷️ Tags
#greedy #hash_table #string #counting #sorting
Telegraph
minimum-number-of-pushes-to-type-word-ii
You are given a string word containing lowercase English letters. Telephone keypads have keys mapped with distinct collections of lowercase English letters, which can be used to form words by pushing them. For example, the key 2 is mapped with ["a","b","c"]…
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…