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-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 所需的最少操作次数。