leetcode.com 2025-06-12
🟢3423.maximum-difference-between-adjacent-elements-in-a-circular-array
🏷️ Tags
#array
🟢3423.maximum-difference-between-adjacent-elements-in-a-circular-array
🏷️ Tags
#array
Telegraph
maximum-difference-between-adjacent-elements-in-a-circular-array
Given a circular array nums, find the maximum absolute difference between adjacent elements. Note: In a circular array, the first and last elements are adjacent. Example 1: Input: nums = [1,2,4] Output: 3 Explanation: Because nums is circular, nums[0] and…
leetcode.cn 2025-06-13
🟡2616.minimize-the-maximum-difference-of-pairs
🏷️ Tags
#greedy #array #binary_search
🟡2616.minimize-the-maximum-difference-of-pairs
🏷️ Tags
#greedy #array #binary_search
Telegraph
minimize-the-maximum-difference-of-pairs
给你一个下标从 0 开始的整数数组 nums 和一个整数 p 。请你从 nums 中找到 p 个下标对,每个下标对对应数值取差值,你需要使得这 p 个差值的 最大值 最小。同时,你需要确保每个下标在这 p 个下标对中最多出现一次。 对于一个下标对 i 和 j ,这一对的差值为 |nums[i] - nums[j]| ,其中 |x| 表示 x 的 绝对值 。 请你返回 p 个下标对对应数值 最大差值 的 最小值 。 示例 1: 输入:nums = [10,1,2,7,1,3], p = 2 输出:1 解释:第一个下标对选择…
leetcode.com 2025-06-13
🟡2616.minimize-the-maximum-difference-of-pairs
🏷️ Tags
#greedy #array #binary_search
🟡2616.minimize-the-maximum-difference-of-pairs
🏷️ Tags
#greedy #array #binary_search
Telegraph
minimize-the-maximum-difference-of-pairs
You are given a 0-indexed integer array nums and an integer p. Find p pairs of indices of nums such that the maximum difference amongst all the pairs is minimized. Also, ensure no index appears more than once amongst the p pairs. Note that for a pair of elements…
leetcode.com 2025-06-15
🟡1432.max-difference-you-can-get-from-changing-an-integer
🏷️ Tags
#greedy #math
🟡1432.max-difference-you-can-get-from-changing-an-integer
🏷️ Tags
#greedy #math
Telegraph
max-difference-you-can-get-from-changing-an-integer
You are given an integer num. You will apply the following steps to num two separate times:
leetcode.cn 2025-06-17
🔴3405.count-the-number-of-arrays-with-k-matching-adjacent-elements
🏷️ Tags
#math #combinatorics
🔴3405.count-the-number-of-arrays-with-k-matching-adjacent-elements
🏷️ Tags
#math #combinatorics
Telegraph
count-the-number-of-arrays-with-k-matching-adjacent-elements
给你三个整数 n ,m ,k 。长度为 n 的 好数组 arr 定义如下:
leetcode.com 2025-06-17
🔴3405.count-the-number-of-arrays-with-k-matching-adjacent-elements
🏷️ Tags
#math #combinatorics
🔴3405.count-the-number-of-arrays-with-k-matching-adjacent-elements
🏷️ Tags
#math #combinatorics
Telegraph
count-the-number-of-arrays-with-k-matching-adjacent-elements
You are given three integers n, m, k. A good array arr of size n is defined as follows:
leetcode.cn 2025-06-18
🟡2966.divide-array-into-arrays-with-max-difference
🏷️ Tags
#greedy #array #sorting
🟡2966.divide-array-into-arrays-with-max-difference
🏷️ Tags
#greedy #array #sorting
Telegraph
divide-array-into-arrays-with-max-difference
给你一个长度为 n 的整数数组 nums,以及一个正整数 k 。 将这个数组划分为 n / 3 个长度为 3 的子数组,并满足以下条件:
leetcode.com 2025-06-18
🟡2966.divide-array-into-arrays-with-max-difference
🏷️ Tags
#greedy #array #sorting
🟡2966.divide-array-into-arrays-with-max-difference
🏷️ Tags
#greedy #array #sorting
Telegraph
divide-array-into-arrays-with-max-difference
You are given an integer array nums of size n where n is a multiple of 3 and a positive integer k. Divide the array nums into n / 3 arrays of size 3 satisfying the following condition:
leetcode.cn 2025-06-19
🟡2294.partition-array-such-that-maximum-difference-is-k
🏷️ Tags
#greedy #array #sorting
🟡2294.partition-array-such-that-maximum-difference-is-k
🏷️ Tags
#greedy #array #sorting
Telegraph
partition-array-such-that-maximum-difference-is-k
给你一个整数数组 nums 和一个整数 k 。你可以将 nums 划分成一个或多个 子序列 ,使 nums 中的每个元素都 恰好 出现在一个子序列中。 在满足每个子序列中最大值和最小值之间的差值最多为 k 的前提下,返回需要划分的 最少 子序列数目。 子序列 本质是一个序列,可以通过删除另一个序列中的某些元素(或者不删除)但不改变剩下元素的顺序得到。 示例 1: 输入:nums = [3,6,1,2,5], k = 2 输出:2 解释: 可以将 nums 划分为两个子序列 [3,1,2] 和 [6,5]…
leetcode.com 2025-06-19
🟡2294.partition-array-such-that-maximum-difference-is-k
🏷️ Tags
#greedy #array #sorting
🟡2294.partition-array-such-that-maximum-difference-is-k
🏷️ Tags
#greedy #array #sorting
Telegraph
partition-array-such-that-maximum-difference-is-k
You are given an integer array nums and an integer k. You may partition nums into one or more subsequences such that each element in nums appears in exactly one of the subsequences. Return the minimum number of subsequences needed such that the difference…
leetcode.cn 2025-06-20
🟡3443.maximum-manhattan-distance-after-k-changes
🏷️ Tags
#hash_table #math #string #counting
🟡3443.maximum-manhattan-distance-after-k-changes
🏷️ Tags
#hash_table #math #string #counting
Telegraph
maximum-manhattan-distance-after-k-changes
给你一个由字符 'N'、'S'、'E' 和 'W' 组成的字符串 s,其中 s[i] 表示在无限网格中的移动操作:
leetcode.com 2025-06-20
🟡3443.maximum-manhattan-distance-after-k-changes
🏷️ Tags
#hash_table #math #string #counting
🟡3443.maximum-manhattan-distance-after-k-changes
🏷️ Tags
#hash_table #math #string #counting
Telegraph
maximum-manhattan-distance-after-k-changes
You are given a string s consisting of the characters 'N', 'S', 'E', and 'W', where s[i] indicates movements in an infinite grid:
leetcode.cn 2025-06-21
🟡3085.minimum-deletions-to-make-string-k-special
🏷️ Tags
#greedy #hash_table #string #counting #sorting
🟡3085.minimum-deletions-to-make-string-k-special
🏷️ Tags
#greedy #hash_table #string #counting #sorting
Telegraph
minimum-deletions-to-make-string-k-special
给你一个字符串 word 和一个整数 k。 如果 |freq(word[i]) - freq(word[j])| <= k 对于字符串中所有下标 i 和 j 都成立,则认为 word 是 k 特殊字符串。 此处,freq(x) 表示字符 x 在 word 中的出现频率,而 |y| 表示 y 的绝对值。 返回使 word 成为 k 特殊字符串 需要删除的字符的最小数量。 示例 1: 输入:word = "aabcaba", k = 0 输出:3 解释:可以删除 2 个 "a" 和 1 个 "c" 使…
leetcode.com 2025-06-21
🟡3085.minimum-deletions-to-make-string-k-special
🏷️ Tags
#greedy #hash_table #string #counting #sorting
🟡3085.minimum-deletions-to-make-string-k-special
🏷️ Tags
#greedy #hash_table #string #counting #sorting
Telegraph
minimum-deletions-to-make-string-k-special
You are given a string word and an integer k. We consider word to be k-special if |freq(word[i]) - freq(word[j])| <= k for all indices i and j in the string. Here, freq(x) denotes the frequency of the character x in word, and |y| denotes the absolute value…