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:
leetcode.cn 2025-11-10
🟡3542.minimum-operations-to-convert-all-elements-to-zero
🏷️ Tags
#stack #greedy #array #hash_table #monotonic_stack
🟡3542.minimum-operations-to-convert-all-elements-to-zero
🏷️ Tags
#stack #greedy #array #hash_table #monotonic_stack
Telegraph
minimum-operations-to-convert-all-elements-to-zero
给你一个大小为 n 的 非负 整数数组 nums 。你的任务是对该数组执行若干次(可能为 0 次)操作,使得 所有 元素都变为 0。 在一次操作中,你可以选择一个子数组 [i, j](其中 0 <= i <= j < n),将该子数组中所有 最小的非负整数 的设为 0。 返回使整个数组变为 0 所需的最少操作次数。
leetcode.com 2025-11-10
🟡3542.minimum-operations-to-convert-all-elements-to-zero
🏷️ Tags
#stack #greedy #array #hash_table #monotonic_stack
🟡3542.minimum-operations-to-convert-all-elements-to-zero
🏷️ Tags
#stack #greedy #array #hash_table #monotonic_stack
Telegraph
minimum-operations-to-convert-all-elements-to-zero
You are given an array nums of size n, consisting of non-negative integers. Your task is to apply some (possibly zero) operations on the array so that all elements become 0. In one operation, you can select a subarray [i, j] (where 0 <= i <= j < n) and set…
leetcode.cn 2025-11-12
🟡2654.minimum-number-of-operations-to-make-all-array-elements-equal-to-1
🏷️ Tags
#array #math #number_theory
🟡2654.minimum-number-of-operations-to-make-all-array-elements-equal-to-1
🏷️ Tags
#array #math #number_theory
Telegraph
minimum-number-of-operations-to-make-all-array-elements-equal-to-1
给你一个下标从 0 开始的 正 整数数组 nums 。你可以对数组执行以下操作 任意 次:
leetcode.com 2025-11-12
🟡2654.minimum-number-of-operations-to-make-all-array-elements-equal-to-1
🏷️ Tags
#array #math #number_theory
🟡2654.minimum-number-of-operations-to-make-all-array-elements-equal-to-1
🏷️ Tags
#array #math #number_theory
Telegraph
minimum-number-of-operations-to-make-all-array-elements-equal-to-1
You are given a 0-indexed array nums consisiting of positive integers. You can do the following operation on the array any number of times:
leetcode.cn 2025-11-13
🟡3228.maximum-number-of-operations-to-move-ones-to-the-end
🏷️ Tags
#greedy #string #counting
🟡3228.maximum-number-of-operations-to-move-ones-to-the-end
🏷️ Tags
#greedy #string #counting
Telegraph
maximum-number-of-operations-to-move-ones-to-the-end
给你一个 二进制字符串 s。 你可以对这个字符串执行 任意次 下述操作: