leetcode.cn 2025-06-26
🟡2311.longest-binary-subsequence-less-than-or-equal-to-k
🏷️ Tags
#greedy #memoization #string #dynamic_programming
🟡2311.longest-binary-subsequence-less-than-or-equal-to-k
🏷️ Tags
#greedy #memoization #string #dynamic_programming
Telegraph
longest-binary-subsequence-less-than-or-equal-to-k
给你一个二进制字符串 s 和一个正整数 k 。 请你返回 s 的 最长 子序列的长度,且该子序列对应的 二进制 数字小于等于 k 。 注意:
leetcode.com 2025-06-26
🟡2311.longest-binary-subsequence-less-than-or-equal-to-k
🏷️ Tags
#greedy #memoization #string #dynamic_programming
🟡2311.longest-binary-subsequence-less-than-or-equal-to-k
🏷️ Tags
#greedy #memoization #string #dynamic_programming
Telegraph
longest-binary-subsequence-less-than-or-equal-to-k
You are given a binary string s and a positive integer k. Return the length of the longest subsequence of s that makes up a binary number less than or equal to k. Note:
leetcode.cn 2025-06-27
🔴2014.longest-subsequence-repeated-k-times
🏷️ Tags
#greedy #string #backtracking #counting #enumeration
🔴2014.longest-subsequence-repeated-k-times
🏷️ Tags
#greedy #string #backtracking #counting #enumeration
Telegraph
longest-subsequence-repeated-k-times
给你一个长度为 n 的字符串 s ,和一个整数 k 。请你找出字符串 s 中 重复 k 次的 最长子序列 。 子序列 是由其他字符串删除某些(或不删除)字符派生而来的一个字符串。 如果 seq * k 是 s 的一个子序列,其中 seq * k 表示一个由 seq 串联 k 次构造的字符串,那么就称 seq 是字符串 s 中一个 重复 k 次 的子序列。
leetcode.com 2025-06-27
🔴2014.longest-subsequence-repeated-k-times
🏷️ Tags
#greedy #string #backtracking #counting #enumeration
🔴2014.longest-subsequence-repeated-k-times
🏷️ Tags
#greedy #string #backtracking #counting #enumeration
Telegraph
longest-subsequence-repeated-k-times
You are given a string s of length n, and an integer k. You are tasked to find the longest subsequence repeated k times in string s. A subsequence is a string that can be derived from another string by deleting some or no characters without changing the order…
leetcode.cn 2025-06-28
🟢2099.find-subsequence-of-length-k-with-the-largest-sum
🏷️ Tags
#array #hash_table #sorting #heap_priority_queue
🟢2099.find-subsequence-of-length-k-with-the-largest-sum
🏷️ Tags
#array #hash_table #sorting #heap_priority_queue
Telegraph
find-subsequence-of-length-k-with-the-largest-sum
给你一个整数数组 nums 和一个整数 k 。你需要找到 nums 中长度为 k 的 子序列 ,且这个子序列的 和最大 。 请你返回 任意 一个长度为 k 的整数子序列。 子序列 定义为从一个数组里删除一些元素后,不改变剩下元素的顺序得到的数组。 示例 1: 输入:nums = [2,1,3,3], k = 2 输出:[3,3] 解释: 子序列有最大和:3 + 3 = 6 。 示例 2: 输入:nums = [-1,-2,3,4], k = 3 输出:[-1,3,4] 解释: 子序列有最大和:-1 +…
leetcode.com 2025-06-28
🟢2099.find-subsequence-of-length-k-with-the-largest-sum
🏷️ Tags
#array #hash_table #sorting #heap_priority_queue
🟢2099.find-subsequence-of-length-k-with-the-largest-sum
🏷️ Tags
#array #hash_table #sorting #heap_priority_queue
Telegraph
find-subsequence-of-length-k-with-the-largest-sum
You are given an integer array nums and an integer k. You want to find a subsequence of nums of length k that has the largest sum. Return any such subsequence as an integer array of length k. A subsequence is an array that can be derived from another array…
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-06-30
🟢594.longest-harmonious-subsequence
🏷️ Tags
#array #hash_table #counting #sorting #sliding_window
🟢594.longest-harmonious-subsequence
🏷️ Tags
#array #hash_table #counting #sorting #sliding_window
Telegraph
longest-harmonious-subsequence
和谐数组是指一个数组里元素的最大值和最小值之间的差别 正好是 1 。 给你一个整数数组 nums ,请你在所有可能的 子序列 中找到最长的和谐子序列的长度。 数组的 子序列 是一个由数组派生出来的序列,它可以通过删除一些元素或不删除元素、且不改变其余元素的顺序而得到。 示例 1: 输入:nums = [1,3,2,2,5,2,3,7] 输出:5 解释: 最长和谐子序列是 [3,2,2,2,3]。 示例 2: 输入:nums = [1,2,3,4] 输出:2 解释: 最长和谐子序列是 [1,2],[2…
leetcode.com 2025-06-30
🟢594.longest-harmonious-subsequence
🏷️ Tags
#array #hash_table #counting #sorting #sliding_window
🟢594.longest-harmonious-subsequence
🏷️ Tags
#array #hash_table #counting #sorting #sliding_window
Telegraph
longest-harmonious-subsequence
We define a harmonious array as an array where the difference between its maximum value and its minimum value is exactly 1. Given an integer array nums, return the length of its longest harmonious subsequence among all its possible subsequences. Example…