leetcode.com 2026-01-29
🟡2976.minimum-cost-to-convert-string-i
🏷️ Tags
#graph #array #string #shortest_path
🟡2976.minimum-cost-to-convert-string-i
🏷️ Tags
#graph #array #string #shortest_path
Telegraph
minimum-cost-to-convert-string-i
You are given two 0-indexed strings source and target, both of length n and consisting of lowercase English letters. You are also given two 0-indexed character arrays original and changed, and an integer array cost, where cost[i] represents the cost of changing…
leetcode.cn 2026-01-30
🔴2977.minimum-cost-to-convert-string-ii
🏷️ Tags
#graph #trie #array #string #dynamic_programming #shortest_path
🔴2977.minimum-cost-to-convert-string-ii
🏷️ Tags
#graph #trie #array #string #dynamic_programming #shortest_path
Telegraph
minimum-cost-to-convert-string-ii
给你两个下标从 0 开始的字符串 source 和 target ,它们的长度均为 n 并且由 小写 英文字母组成。 另给你两个下标从 0 开始的字符串数组 original 和 changed ,以及一个整数数组 cost ,其中 cost[i] 代表将字符串 original[i] 更改为字符串 changed[i] 的成本。 你从字符串 source 开始。在一次操作中,如果 存在 任意 下标 j 满足 cost[j] == z 、original[j] == x 以及 changed[j] ==…
leetcode.com 2026-01-30
🔴2977.minimum-cost-to-convert-string-ii
🏷️ Tags
#graph #trie #array #string #dynamic_programming #shortest_path
🔴2977.minimum-cost-to-convert-string-ii
🏷️ Tags
#graph #trie #array #string #dynamic_programming #shortest_path
Telegraph
minimum-cost-to-convert-string-ii
You are given two 0-indexed strings source and target, both of length n and consisting of lowercase English characters. You are also given two 0-indexed string arrays original and changed, and an integer array cost, where cost[i] represents the cost of converting…
leetcode.cn 2026-02-01
🟢3010.divide-an-array-into-subarrays-with-minimum-cost-i
🏷️ Tags
#array #enumeration #sorting
🟢3010.divide-an-array-into-subarrays-with-minimum-cost-i
🏷️ Tags
#array #enumeration #sorting
Telegraph
divide-an-array-into-subarrays-with-minimum-cost-i
给你一个长度为 n 的整数数组 nums 。 一个数组的 代价 是它的 第一个 元素。比方说,[1,2,3] 的代价是 1 ,[3,4,1] 的代价是 3 。 你需要将 nums 分成 3 个 连续且没有交集 的子数组。 请你返回这些子数组的 最小 代价 总和 。 示例 1: 输入:nums = [1,2,3,12] 输出:6 解释:最佳分割成 3 个子数组的方案是:[1] ,[2] 和 [3,12] ,总代价为 1 + 2 + 3 = 6 。 其他得到 3 个子数组的方案是: - [1] ,[2,3]…
leetcode.com 2026-02-01
🟢3010.divide-an-array-into-subarrays-with-minimum-cost-i
🏷️ Tags
#array #enumeration #sorting
🟢3010.divide-an-array-into-subarrays-with-minimum-cost-i
🏷️ Tags
#array #enumeration #sorting
Telegraph
divide-an-array-into-subarrays-with-minimum-cost-i
You are given an array of integers nums of length n. The cost of an array is the value of its first element. For example, the cost of [1,2,3] is 1 while the cost of [3,4,1] is 3. You need to divide nums into 3 disjoint contiguous subarrays. Return the minimum…
leetcode.cn 2026-02-02
🔴3013.divide-an-array-into-subarrays-with-minimum-cost-ii
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
🔴3013.divide-an-array-into-subarrays-with-minimum-cost-ii
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
Telegraph
divide-an-array-into-subarrays-with-minimum-cost-ii
给你一个下标从 0 开始长度为 n 的整数数组 nums 和两个 正 整数 k 和 dist 。 一个数组的 代价 是数组中的 第一个 元素。比方说,[1,2,3] 的代价为 1 ,[3,4,1] 的代价为 3 。 你需要将 nums 分割成 k 个 连续且互不相交 的子数组,满足 第二 个子数组与第 k 个子数组中第一个元素的下标距离 不超过 dist 。换句话说,如果你将 nums 分割成子数组 nums[0..(i1 - 1)], nums[i1..(i2 - 1)], ..., nums[ik-1..(n…
leetcode.com 2026-02-02
🔴3013.divide-an-array-into-subarrays-with-minimum-cost-ii
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
🔴3013.divide-an-array-into-subarrays-with-minimum-cost-ii
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
Telegraph
divide-an-array-into-subarrays-with-minimum-cost-ii
You are given a 0-indexed array of integers nums of length n, and two positive integers k and dist. The cost of an array is the value of its first element. For example, the cost of [1,2,3] is 1 while the cost of [3,4,1] is 3. You need to divide nums into…
leetcode.com 2026-02-06
🟡3634.minimum-removals-to-balance-array
🏷️ Tags
#array #sorting #sliding_window
🟡3634.minimum-removals-to-balance-array
🏷️ Tags
#array #sorting #sliding_window
Telegraph
minimum-removals-to-balance-array
You are given an integer array nums and an integer k. An array is considered balanced if the value of its maximum element is at most k times the minimum element. You may remove any number of elements from nums without making it empty. Return the minimum…
leetcode.cn 2026-02-07
🟡1653.minimum-deletions-to-make-string-balanced
🏷️ Tags
#stack #string #dynamic_programming
🟡1653.minimum-deletions-to-make-string-balanced
🏷️ Tags
#stack #string #dynamic_programming
Telegraph
minimum-deletions-to-make-string-balanced
给你一个字符串 s ,它仅包含字符 'a' 和 'b' 。 你可以删除 s 中任意数目的字符,使得 s 平衡 。当不存在下标对 (i,j) 满足 i < j ,且 s[i] = 'b' 的同时 s[j]= 'a' ,此时认为 s 是 平衡 的。 请你返回使 s 平衡 的 最少 删除次数。 示例 1: 输入:s = "aababbab" 输出:2 解释:你可以选择以下任意一种方案: 下标从 0 开始,删除第 2 和第 6 个字符("aababbab" -> "aaabbb"), 下标从 0 开始,删除第…
leetcode.com 2026-02-07
🟡1653.minimum-deletions-to-make-string-balanced
🏷️ Tags
#stack #string #dynamic_programming
🟡1653.minimum-deletions-to-make-string-balanced
🏷️ Tags
#stack #string #dynamic_programming
Telegraph
minimum-deletions-to-make-string-balanced
You are given a string s consisting only of characters 'a' and 'b'. You can delete any number of characters in s to make s balanced. s is balanced if there is no pair of indices (i,j) such that i < j and s[i] = 'b' and s[j]= 'a'. Return the minimum number…