leetcode.cn 2025-05-14
🔴3337.total-characters-in-string-after-transformations-ii
🏷️ Tags
#hash_table #math #string #dynamic_programming #counting
🔴3337.total-characters-in-string-after-transformations-ii
🏷️ Tags
#hash_table #math #string #dynamic_programming #counting
Telegraph
total-characters-in-string-after-transformations-ii
给你一个由小写英文字母组成的字符串 s,一个整数 t 表示要执行的 转换 次数,以及一个长度为 26 的数组 nums。每次 转换 需要根据以下规则替换字符串 s 中的每个字符:
leetcode.com 2025-05-14
🔴3337.total-characters-in-string-after-transformations-ii
🏷️ Tags
#hash_table #math #string #dynamic_programming #counting
🔴3337.total-characters-in-string-after-transformations-ii
🏷️ Tags
#hash_table #math #string #dynamic_programming #counting
Telegraph
total-characters-in-string-after-transformations-ii
You are given a string s consisting of lowercase English letters, an integer t representing the number of transformations to perform, and an array nums of size 26. In one transformation, every character in s is replaced according to the following rules:
leetcode.cn 2025-05-15
🟢2900.longest-unequal-adjacent-groups-subsequence-i
🏷️ Tags
#greedy #array #string #dynamic_programming
🟢2900.longest-unequal-adjacent-groups-subsequence-i
🏷️ Tags
#greedy #array #string #dynamic_programming
Telegraph
longest-unequal-adjacent-groups-subsequence-i
给你一个下标从 0 开始的字符串数组 words ,和一个下标从 0 开始的 二进制 数组 groups ,两个数组长度都是 n 。 你需要从 words 中选出 最长子序列。如果对于序列中的任何两个连续串,二进制数组 groups 中它们的对应元素不同,则 words 的子序列是不同的。 正式来说,你需要从下标 [0, 1, ..., n - 1] 中选出一个 最长子序列 ,将这个子序列记作长度为 k 的 [i0, i1, ..., ik - 1] ,对于所有满足 0 <= j < k - 1 的 j 都有 groups[ij]…
leetcode.com 2025-05-15
🟢2900.longest-unequal-adjacent-groups-subsequence-i
🏷️ Tags
#greedy #array #string #dynamic_programming
🟢2900.longest-unequal-adjacent-groups-subsequence-i
🏷️ Tags
#greedy #array #string #dynamic_programming
Telegraph
longest-unequal-adjacent-groups-subsequence-i
You are given a string array words and a binary array groups both of length n, where words[i] is associated with groups[i]. Your task is to select the longest alternating subsequence from words. A subsequence of words is alternating if for any two consecutive…
leetcode.cn 2025-05-16
🟡2901.longest-unequal-adjacent-groups-subsequence-ii
🏷️ Tags
#array #string #dynamic_programming
🟡2901.longest-unequal-adjacent-groups-subsequence-ii
🏷️ Tags
#array #string #dynamic_programming
Telegraph
longest-unequal-adjacent-groups-subsequence-ii
给你一个整数 n 和一个下标从 0 开始的字符串数组 words ,和一个下标从 0 开始的数组 groups ,两个数组长度都是 n 。 两个长度相等字符串的 汉明距离 定义为对应位置字符 不同 的数目。 你需要从下标 [0, 1, ..., n - 1] 中选出一个 最长子序列 ,将这个子序列记作长度为 k 的 [i0, i1, ..., ik - 1] ,它需要满足以下条件:
leetcode.com 2025-05-16
🟡2901.longest-unequal-adjacent-groups-subsequence-ii
🏷️ Tags
#array #string #dynamic_programming
🟡2901.longest-unequal-adjacent-groups-subsequence-ii
🏷️ Tags
#array #string #dynamic_programming
Telegraph
longest-unequal-adjacent-groups-subsequence-ii
You are given a string array words, and an array groups, both arrays having length n. The hamming distance between two strings of equal length is the number of positions at which the corresponding characters are different. You need to select the longest subsequence…
leetcode.cn 2025-05-22
🟡3362.zero-array-transformation-iii
🏷️ Tags
#greedy #array #prefix_sum #sorting #heap_priority_queue
🟡3362.zero-array-transformation-iii
🏷️ Tags
#greedy #array #prefix_sum #sorting #heap_priority_queue
Telegraph
zero-array-transformation-iii
给你一个长度为 n 的整数数组 nums 和一个二维数组 queries ,其中 queries[i] = [li, ri] 。 每一个 queries[i] 表示对于 nums 的以下操作:
leetcode.com 2025-05-22
🟡3362.zero-array-transformation-iii
🏷️ Tags
#greedy #array #prefix_sum #sorting #heap_priority_queue
🟡3362.zero-array-transformation-iii
🏷️ Tags
#greedy #array #prefix_sum #sorting #heap_priority_queue
Telegraph
zero-array-transformation-iii
You are given an integer array nums of length n and a 2D array queries where queries[i] = [li, ri]. Each queries[i] represents the following action on nums:
leetcode.cn 2025-05-23
🔴3068.find-the-maximum-sum-of-node-values
🏷️ Tags
#greedy #bit_manipulation #tree #array #dynamic_programming #sorting
🔴3068.find-the-maximum-sum-of-node-values
🏷️ Tags
#greedy #bit_manipulation #tree #array #dynamic_programming #sorting
Telegraph
find-the-maximum-sum-of-node-values
给你一棵 n 个节点的 无向 树,节点从 0 到 n - 1 编号。树以长度为 n - 1 下标从 0 开始的二维整数数组 edges 的形式给你,其中 edges[i] = [ui, vi] 表示树中节点 ui 和 vi 之间有一条边。同时给你一个 正 整数 k 和一个长度为 n 下标从 0 开始的 非负 整数数组 nums ,其中 nums[i] 表示节点 i 的 价值 。 Alice 想 最大化 树中所有节点价值之和。为了实现这一目标,Alice 可以执行以下操作 任意 次(包括 0 次):
leetcode.com 2025-05-23
🔴3068.find-the-maximum-sum-of-node-values
🏷️ Tags
#greedy #bit_manipulation #tree #array #dynamic_programming #sorting
🔴3068.find-the-maximum-sum-of-node-values
🏷️ Tags
#greedy #bit_manipulation #tree #array #dynamic_programming #sorting
Telegraph
find-the-maximum-sum-of-node-values
There exists an undirected tree with n nodes numbered 0 to n - 1. You are given a 0-indexed 2D integer array edges of length n - 1, where edges[i] = [ui, vi] indicates that there is an edge between nodes ui and vi in the tree. You are also given a positive…