leetcode.cn 2025-10-30
🔴1526.minimum-number-of-increments-on-subarrays-to-form-a-target-array
🏷️ Tags
#stack #greedy #array #dynamic_programming #monotonic_stack
🔴1526.minimum-number-of-increments-on-subarrays-to-form-a-target-array
🏷️ Tags
#stack #greedy #array #dynamic_programming #monotonic_stack
Telegraph
minimum-number-of-increments-on-subarrays-to-form-a-target-array
给你一个整数数组 target 和一个数组 initial ,initial 数组与 target 数组有同样的维度,且一开始全部为 0 。 请你返回从 initial 得到 target 的最少操作次数,每次操作需遵循以下规则:
leetcode.com 2025-10-30
🔴1526.minimum-number-of-increments-on-subarrays-to-form-a-target-array
🏷️ Tags
#stack #greedy #array #dynamic_programming #monotonic_stack
🔴1526.minimum-number-of-increments-on-subarrays-to-form-a-target-array
🏷️ Tags
#stack #greedy #array #dynamic_programming #monotonic_stack
Telegraph
minimum-number-of-increments-on-subarrays-to-form-a-target-array
You are given an integer array target. You have an integer array initial of the same size as target with all elements initially zeros. In one operation you can choose any subarray from initial and increment each value by one. Return the minimum number of…
leetcode.cn 2025-11-01
🟡3217.delete-nodes-from-linked-list-present-in-array
🏷️ Tags
#array #hash_table #linked_list
🟡3217.delete-nodes-from-linked-list-present-in-array
🏷️ Tags
#array #hash_table #linked_list
Telegraph
delete-nodes-from-linked-list-present-in-array
给你一个整数数组 nums 和一个链表的头节点 head。从链表中移除所有存在于 nums 中的节点后,返回修改后的链表的头节点。 示例 1: 输入: nums = [1,2,3], head = [1,2,3,4,5] 输出: [4,5] 解释: 移除数值为 1, 2 和 3 的节点。 示例 2: 输入: nums = [1], head = [1,2,1,2,1,2] 输出: [2,2,2] 解释: 移除数值为 1 的节点。 示例 3: 输入: nums = [5], head = [1,2,3…
leetcode.com 2025-11-01
🟡3217.delete-nodes-from-linked-list-present-in-array
🏷️ Tags
#array #hash_table #linked_list
🟡3217.delete-nodes-from-linked-list-present-in-array
🏷️ Tags
#array #hash_table #linked_list
Telegraph
delete-nodes-from-linked-list-present-in-array
You are given an array of integers nums and the head of a linked list. Return the head of the modified linked list after removing all nodes from the linked list that have a value that exists in nums. Example 1: Input: nums = [1,2,3], head = [1,2,3,4,5]…
leetcode.cn 2025-11-03
🟡1578.minimum-time-to-make-rope-colorful
🏷️ Tags
#greedy #array #string #dynamic_programming
🟡1578.minimum-time-to-make-rope-colorful
🏷️ Tags
#greedy #array #string #dynamic_programming
Telegraph
minimum-time-to-make-rope-colorful
Alice 把 n 个气球排列在一根绳子上。给你一个下标从 0 开始的字符串 colors ,其中 colors[i] 是第 i 个气球的颜色。 Alice 想要把绳子装扮成 五颜六色的 ,且她不希望两个连续的气球涂着相同的颜色,所以她喊来 Bob 帮忙。Bob 可以从绳子上移除一些气球使绳子变成 彩色 。给你一个 下标从 0 开始 的整数数组 neededTime ,其中 neededTime[i] 是 Bob 从绳子上移除第 i 个气球需要的时间(以秒为单位)。 返回 Bob 使绳子变成 彩色 需要的…
leetcode.com 2025-11-03
🟡1578.minimum-time-to-make-rope-colorful
🏷️ Tags
#greedy #array #string #dynamic_programming
🟡1578.minimum-time-to-make-rope-colorful
🏷️ Tags
#greedy #array #string #dynamic_programming
Telegraph
minimum-time-to-make-rope-colorful
Alice has n balloons arranged on a rope. You are given a 0-indexed string colors where colors[i] is the color of the ith balloon. Alice wants the rope to be colorful. She does not want two consecutive balloons to be of the same color, so she asks Bob for…
leetcode.cn 2025-11-04
🟢3318.find-x-sum-of-all-k-long-subarrays-i
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
🟢3318.find-x-sum-of-all-k-long-subarrays-i
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
Telegraph
find-x-sum-of-all-k-long-subarrays-i
给你一个由 n 个整数组成的数组 nums,以及两个整数 k 和 x。 数组的 x-sum 计算按照以下步骤进行:
leetcode.com 2025-11-04
🟢3318.find-x-sum-of-all-k-long-subarrays-i
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
🟢3318.find-x-sum-of-all-k-long-subarrays-i
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
Telegraph
find-x-sum-of-all-k-long-subarrays-i
You are given an array nums of n integers and two integers k and x. The x-sum of an array is calculated by the following procedure:
leetcode.cn 2025-11-05
🔴3321.find-x-sum-of-all-k-long-subarrays-ii
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
🔴3321.find-x-sum-of-all-k-long-subarrays-ii
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
Telegraph
find-x-sum-of-all-k-long-subarrays-ii
给你一个由 n 个整数组成的数组 nums,以及两个整数 k 和 x。 数组的 x-sum 计算按照以下步骤进行:
leetcode.com 2025-11-05
🔴3321.find-x-sum-of-all-k-long-subarrays-ii
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
🔴3321.find-x-sum-of-all-k-long-subarrays-ii
🏷️ Tags
#array #hash_table #sliding_window #heap_priority_queue
Telegraph
find-x-sum-of-all-k-long-subarrays-ii
You are given an array nums of n integers and two integers k and x. The x-sum of an array is calculated by the following procedure:
leetcode.cn 2025-11-06
🟡3607.power-grid-maintenance
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #graph #array #hash_table #ordered_set #heap_priority_queue
🟡3607.power-grid-maintenance
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #graph #array #hash_table #ordered_set #heap_priority_queue
Telegraph
power-grid-maintenance
给你一个整数 c,表示 c 个电站,每个电站有一个唯一标识符 id,从 1 到 c 编号。 这些电站通过 n 条 双向 电缆互相连接,表示为一个二维数组 connections,其中每个元素 connections[i] = [ui, vi] 表示电站 ui 和电站 vi 之间的连接。直接或间接连接的电站组成了一个 电网 。 最初,所有 电站均处于在线(正常运行)状态。 另给你一个二维数组 queries,其中每个查询属于以下 两种类型之一 :
leetcode.com 2025-11-06
🟡3607.power-grid-maintenance
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #graph #array #hash_table #ordered_set #heap_priority_queue
🟡3607.power-grid-maintenance
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #graph #array #hash_table #ordered_set #heap_priority_queue
Telegraph
power-grid-maintenance
You are given an integer c representing c power stations, each with a unique identifier id from 1 to c (1‑based indexing). These stations are interconnected via n bidirectional cables, represented by a 2D array connections, where each element connections[i]…
leetcode.cn 2025-11-07
🔴2528.maximize-the-minimum-powered-city
🏷️ Tags
#greedy #queue #array #binary_search #prefix_sum #sliding_window
🔴2528.maximize-the-minimum-powered-city
🏷️ Tags
#greedy #queue #array #binary_search #prefix_sum #sliding_window
Telegraph
maximize-the-minimum-powered-city
给你一个下标从 0 开始长度为 n 的整数数组 stations ,其中 stations[i] 表示第 i 座城市的供电站数目。 每个供电站可以在一定 范围 内给所有城市提供电力。换句话说,如果给定的范围是 r ,在城市 i 处的供电站可以给所有满足 |i - j| <= r 且 0 <= i, j <= n - 1 的城市 j 供电。
leetcode.com 2025-11-07
🔴2528.maximize-the-minimum-powered-city
🏷️ Tags
#greedy #queue #array #binary_search #prefix_sum #sliding_window
🔴2528.maximize-the-minimum-powered-city
🏷️ Tags
#greedy #queue #array #binary_search #prefix_sum #sliding_window
Telegraph
maximize-the-minimum-powered-city
You are given a 0-indexed integer array stations of length n, where stations[i] represents the number of power stations in the ith city. Each power station can provide power to every city in a fixed range. In other words, if the range is denoted by r, then…
leetcode.cn 2025-11-08
🔴1611.minimum-one-bit-operations-to-make-integers-zero
🏷️ Tags
#bit_manipulation #memoization #dynamic_programming
🔴1611.minimum-one-bit-operations-to-make-integers-zero
🏷️ Tags
#bit_manipulation #memoization #dynamic_programming
Telegraph
minimum-one-bit-operations-to-make-integers-zero
给你一个整数 n,你需要重复执行多次下述操作将其转换为 0 :
leetcode.com 2025-11-08
🔴1611.minimum-one-bit-operations-to-make-integers-zero
🏷️ Tags
#bit_manipulation #memoization #dynamic_programming
🔴1611.minimum-one-bit-operations-to-make-integers-zero
🏷️ Tags
#bit_manipulation #memoization #dynamic_programming
Telegraph
minimum-one-bit-operations-to-make-integers-zero
Given an integer n, you must transform it into 0 using the following operations any number of times: