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。 你可以对这个字符串执行 任意次 下述操作:
leetcode.com 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
You are given a binary string s. You can perform the following operation on the string any number of times:
leetcode.cn 2025-11-15
🟡3234.count-the-number-of-substrings-with-dominant-ones
🏷️ Tags
#string #enumeration #sliding_window
🟡3234.count-the-number-of-substrings-with-dominant-ones
🏷️ Tags
#string #enumeration #sliding_window
Telegraph
count-the-number-of-substrings-with-dominant-ones
给你一个二进制字符串 s。 请你统计并返回其中 1 显著 的 子字符串 的数量。 如果字符串中 1 的数量 大于或等于 0 的数量的 平方,则认为该字符串是一个 1 显著 的字符串 。 示例 1: 输入:s = "00011" 输出:5 解释: 1 显著的子字符串如下表所示。
leetcode.com 2025-11-15
🟡3234.count-the-number-of-substrings-with-dominant-ones
🏷️ Tags
#string #enumeration #sliding_window
🟡3234.count-the-number-of-substrings-with-dominant-ones
🏷️ Tags
#string #enumeration #sliding_window
Telegraph
count-the-number-of-substrings-with-dominant-ones
You are given a binary string s. Return the number of substrings with dominant ones. A string has dominant ones if the number of ones in the string is greater than or equal to the square of the number of zeros in the string. Example 1: Input: s = "00011"…