leetcode.com 2025-11-27
🟡3381.maximum-subarray-sum-with-length-divisible-by-k
🏷️ Tags
#array #hash_table #prefix_sum
🟡3381.maximum-subarray-sum-with-length-divisible-by-k
🏷️ Tags
#array #hash_table #prefix_sum
Telegraph
maximum-subarray-sum-with-length-divisible-by-k
You are given an array of integers nums and an integer k. Return the maximum sum of a subarray of nums, such that the size of the subarray is divisible by k. Example 1: Input: nums = [1,2], k = 1 Output: 3 Explanation: The subarray [1, 2] with sum 3 has…
leetcode.cn 2025-11-28
🔴2872.maximum-number-of-k-divisible-components
🏷️ Tags
#tree #depth_first_search
🔴2872.maximum-number-of-k-divisible-components
🏷️ Tags
#tree #depth_first_search
Telegraph
maximum-number-of-k-divisible-components
给你一棵 n 个节点的无向树,节点编号为 0 到 n - 1 。给你整数 n 和一个长度为 n - 1 的二维整数数组 edges ,其中 edges[i] = [ai, bi] 表示树中节点 ai 和 bi 有一条边。 同时给你一个下标从 0 开始长度为 n 的整数数组 values ,其中 values[i] 是第 i 个节点的 值 。再给你一个整数 k 。 你可以从树中删除一些边,也可以一条边也不删,得到若干连通块。一个 连通块的值 定义为连通块中所有节点值之和。如果所有连通块的值都可以被 k 整除,那么我们说这是一个…
leetcode.com 2025-11-28
🔴2872.maximum-number-of-k-divisible-components
🏷️ Tags
#tree #depth_first_search
🔴2872.maximum-number-of-k-divisible-components
🏷️ Tags
#tree #depth_first_search
Telegraph
maximum-number-of-k-divisible-components
There is an undirected tree with n nodes labeled from 0 to n - 1. You are given the integer n and a 2D integer array edges of length n - 1, where edges[i] = [ai, bi] indicates that there is an edge between nodes ai and bi in the tree. You are also given a…
leetcode.cn 2025-12-01
🔴2141.maximum-running-time-of-n-computers
🏷️ Tags
#greedy #array #binary_search #sorting
🔴2141.maximum-running-time-of-n-computers
🏷️ Tags
#greedy #array #binary_search #sorting
Telegraph
maximum-running-time-of-n-computers
你有 n 台电脑。给你整数 n 和一个下标从 0 开始的整数数组 batteries ,其中第 i 个电池可以让一台电脑 运行 batteries[i] 分钟。你想使用这些电池让 全部 n 台电脑 同时 运行。 一开始,你可以给每台电脑连接 至多一个电池 。然后在任意整数时刻,你都可以将一台电脑与它的电池断开连接,并连接另一个电池,你可以进行这个操作 任意次 。新连接的电池可以是一个全新的电池,也可以是别的电脑用过的电池。断开连接和连接新的电池不会花费任何时间。 注意,你不能给电池充电。 请你返回你可以让…
leetcode.com 2025-12-01
🔴2141.maximum-running-time-of-n-computers
🏷️ Tags
#greedy #array #binary_search #sorting
🔴2141.maximum-running-time-of-n-computers
🏷️ Tags
#greedy #array #binary_search #sorting
Telegraph
maximum-running-time-of-n-computers
You have n computers. You are given the integer n and a 0-indexed integer array batteries where the ith battery can run a computer for batteries[i] minutes. You are interested in running all n computers simultaneously using the given batteries. Initially…
❤1
leetcode.cn 2025-12-05
🟢3432.count-partitions-with-even-sum-difference
🏷️ Tags
#array #math #prefix_sum
🟢3432.count-partitions-with-even-sum-difference
🏷️ Tags
#array #math #prefix_sum
Telegraph
count-partitions-with-even-sum-difference
给你一个长度为 n 的整数数组 nums 。 分区 是指将数组按照下标 i (0 <= i < n - 1)划分成两个 非空 子数组,其中:
leetcode.com 2025-12-05
🟢3432.count-partitions-with-even-sum-difference
🏷️ Tags
#array #math #prefix_sum
🟢3432.count-partitions-with-even-sum-difference
🏷️ Tags
#array #math #prefix_sum
Telegraph
count-partitions-with-even-sum-difference
You are given an integer array nums of length n. A partition is defined as an index i where 0 <= i < n - 1, splitting the array into two non-empty subarrays such that:
leetcode.cn 2025-12-06
🟡3578.count-partitions-with-max-min-difference-at-most-k
🏷️ Tags
#queue #array #dynamic_programming #prefix_sum #sliding_window #monotonic_queue
🟡3578.count-partitions-with-max-min-difference-at-most-k
🏷️ Tags
#queue #array #dynamic_programming #prefix_sum #sliding_window #monotonic_queue
Telegraph
count-partitions-with-max-min-difference-at-most-k
给你一个整数数组 nums 和一个整数 k。你的任务是将 nums 分割成一个或多个 非空 的连续子段,使得每个子段的 最大值 与 最小值 之间的差值 不超过 k。
leetcode.com 2025-12-06
🟡3578.count-partitions-with-max-min-difference-at-most-k
🏷️ Tags
#queue #array #dynamic_programming #prefix_sum #sliding_window #monotonic_queue
🟡3578.count-partitions-with-max-min-difference-at-most-k
🏷️ Tags
#queue #array #dynamic_programming #prefix_sum #sliding_window #monotonic_queue
Telegraph
count-partitions-with-max-min-difference-at-most-k
You are given an integer array nums and an integer k. Your task is to partition nums into one or more non-empty contiguous segments such that in each segment, the difference between its maximum and minimum elements is at most k. Return the total number of…