leetcode.cn 2026-09-15
🔴2472.maximum-number-of-non-overlapping-palindrome-substrings
🏷️ Tags
#greedy #two_pointers #string #dynamic_programming
🔴2472.maximum-number-of-non-overlapping-palindrome-substrings
🏷️ Tags
#greedy #two_pointers #string #dynamic_programming
Telegraph
maximum-number-of-non-overlapping-palindrome-substrings
给你一个字符串 s 和一个 正 整数 k 。 从字符串 s 中选出一组满足下述条件且 不重叠 的子字符串:
leetcode.com 2026-09-15
🔴2472.maximum-number-of-non-overlapping-palindrome-substrings
🏷️ Tags
#greedy #two_pointers #string #dynamic_programming
🔴2472.maximum-number-of-non-overlapping-palindrome-substrings
🏷️ Tags
#greedy #two_pointers #string #dynamic_programming
Telegraph
maximum-number-of-non-overlapping-palindrome-substrings
You are given a string s and a positive integer k. Select a set of non-overlapping substrings from the string s that satisfy the following conditions:
leetcode.cn 2026-09-16
🟡1621.number-of-sets-of-k-non-overlapping-line-segments
🏷️ Tags
#math #dynamic_programming #combinatorics #prefix_sum
🟡1621.number-of-sets-of-k-non-overlapping-line-segments
🏷️ Tags
#math #dynamic_programming #combinatorics #prefix_sum
Telegraph
number-of-sets-of-k-non-overlapping-line-segments
给你一维空间的 n 个点,其中第 i 个点(编号从 0 到 n-1)位于 x = i 处,请你找到 恰好 k 个不重叠 线段且每个线段至少覆盖两个点的方案数。线段的两个端点必须都是 整数坐标 。这 k 个线段不需要全部覆盖全部 n 个点,且它们的端点 可以 重合。 请你返回 k 个不重叠线段的方案数。由于答案可能很大,请将结果对 109 + 7 取余 后返回。 示例 1: 输入:n = 4, k = 2 输出:5 解释:如图所示,两个线段分别用红色和蓝色标出。 上图展示了 5 种不同的方案 {(0,2)…
leetcode.com 2026-09-16
🟡1621.number-of-sets-of-k-non-overlapping-line-segments
🏷️ Tags
#math #dynamic_programming #combinatorics #prefix_sum
🟡1621.number-of-sets-of-k-non-overlapping-line-segments
🏷️ Tags
#math #dynamic_programming #combinatorics #prefix_sum
Telegraph
number-of-sets-of-k-non-overlapping-line-segments
Given n points on a 1-D plane, where the ith point (from 0 to n-1) is at x = i, find the number of ways we can draw exactly k non-overlapping line segments such that each segment covers two or more points. The endpoints of each segment must have integral…
leetcode.cn 2026-09-17
🟡1477.find-two-non-overlapping-sub-arrays-each-with-target-sum
🏷️ Tags
#array #hash_table #binary_search #dynamic_programming #sliding_window
🟡1477.find-two-non-overlapping-sub-arrays-each-with-target-sum
🏷️ Tags
#array #hash_table #binary_search #dynamic_programming #sliding_window
Telegraph
find-two-non-overlapping-sub-arrays-each-with-target-sum
给你一个整数数组 arr 和一个整数值 target 。 请你在 arr 中找 两个互不重叠的子数组 且它们的和都等于 target 。可能会有多种方案,请你返回满足要求的两个子数组长度和的 最小值 。 请返回满足要求的最小长度和,如果无法找到这样的两个子数组,请返回 -1 。 示例 1: 输入:arr = [3,2,2,4,3], target = 3 输出:2 解释:只有两个子数组和为 3 ([3] 和 [3])。它们的长度和为 2 。 示例 2: 输入:arr = [7,3,4,7], target…
leetcode.com 2026-09-17
🟡1477.find-two-non-overlapping-sub-arrays-each-with-target-sum
🏷️ Tags
#array #hash_table #binary_search #dynamic_programming #sliding_window
🟡1477.find-two-non-overlapping-sub-arrays-each-with-target-sum
🏷️ Tags
#array #hash_table #binary_search #dynamic_programming #sliding_window
Telegraph
find-two-non-overlapping-sub-arrays-each-with-target-sum
You are given an array of integers arr and an integer target. You have to find two non-overlapping sub-arrays of arr each with a sum equal target. There can be multiple answers so you have to find an answer where the sum of the lengths of the two sub-arrays…
leetcode.cn 2026-09-18
🔴1520.maximum-number-of-non-overlapping-substrings
🏷️ Tags
#greedy #hash_table #string #sorting
🔴1520.maximum-number-of-non-overlapping-substrings
🏷️ Tags
#greedy #hash_table #string #sorting
Telegraph
maximum-number-of-non-overlapping-substrings
给你一个只包含小写字母的字符串 s ,你需要找到 s 中最多数目的非空子字符串,满足如下条件:
leetcode.com 2026-09-18
🔴1520.maximum-number-of-non-overlapping-substrings
🏷️ Tags
#greedy #hash_table #string #sorting
🔴1520.maximum-number-of-non-overlapping-substrings
🏷️ Tags
#greedy #hash_table #string #sorting
Telegraph
maximum-number-of-non-overlapping-substrings
Given a string s of lowercase letters, you need to find the maximum number of non-empty substrings of s that meet the following conditions:
leetcode.cn 2026-09-23
🟡1658.minimum-operations-to-reduce-x-to-zero
🏷️ Tags
#array #hash_table #binary_search #prefix_sum #sliding_window
🟡1658.minimum-operations-to-reduce-x-to-zero
🏷️ Tags
#array #hash_table #binary_search #prefix_sum #sliding_window
Telegraph
minimum-operations-to-reduce-x-to-zero
给你一个整数数组 nums 和一个整数 x 。每一次操作时,你应当移除数组 nums 最左边或最右边的元素,然后从 x 中减去该元素的值。请注意,需要 修改 数组以供接下来的操作使用。 如果可以将 x 恰好 减到 0 ,返回 最小操作数 ;否则,返回 -1 。 示例 1: 输入:nums = [1,1,4,2,3], x = 5 输出:2 解释:最佳解决方案是移除后两个元素,将 x 减到 0 。 示例 2: 输入:nums = [5,6,7,8,9], x = 4 输出:-1 示例 3: 输入:nums…
leetcode.com 2026-09-23
🟡1658.minimum-operations-to-reduce-x-to-zero
🏷️ Tags
#array #hash_table #binary_search #prefix_sum #sliding_window
🟡1658.minimum-operations-to-reduce-x-to-zero
🏷️ Tags
#array #hash_table #binary_search #prefix_sum #sliding_window
Telegraph
minimum-operations-to-reduce-x-to-zero
You are given an integer array nums and an integer x. In one operation, you can either remove the leftmost or the rightmost element from the array nums and subtract its value from x. Note that this modifies the array for future operations. Return the minimum…