leetcode.cn 2025-03-17
🟡1963.minimum-number-of-swaps-to-make-the-string-balanced
🏷️ Tags
#stack #greedy #two_pointers #string
🟡1963.minimum-number-of-swaps-to-make-the-string-balanced
🏷️ Tags
#stack #greedy #two_pointers #string
Telegraph
minimum-number-of-swaps-to-make-the-string-balanced
给你一个字符串 s ,下标从 0 开始 ,且长度为偶数 n 。字符串 恰好 由 n / 2 个开括号 '[' 和 n / 2 个闭括号 ']' 组成。 只有能满足下述所有条件的字符串才能称为 平衡字符串 :
leetcode.com 2025-03-17
🟢2206.divide-array-into-equal-pairs
🏷️ Tags
#bit_manipulation #array #hash_table #counting
🟢2206.divide-array-into-equal-pairs
🏷️ Tags
#bit_manipulation #array #hash_table #counting
Telegraph
divide-array-into-equal-pairs
You are given an integer array nums consisting of 2 * n integers. You need to divide nums into n pairs such that:
leetcode.cn 2025-03-19
🟡2610.convert-an-array-into-a-2d-array-with-conditions
🏷️ Tags
#array #hash_table
🟡2610.convert-an-array-into-a-2d-array-with-conditions
🏷️ Tags
#array #hash_table
Telegraph
convert-an-array-into-a-2d-array-with-conditions
给你一个整数数组 nums 。请你创建一个满足以下条件的二维数组:
leetcode.com 2025-03-19
🟡3191.minimum-operations-to-make-binary-array-elements-equal-to-one-i
🏷️ Tags
#bit_manipulation #queue #array #prefix_sum #sliding_window
🟡3191.minimum-operations-to-make-binary-array-elements-equal-to-one-i
🏷️ Tags
#bit_manipulation #queue #array #prefix_sum #sliding_window
Telegraph
minimum-operations-to-make-binary-array-elements-equal-to-one-i
You are given a binary array nums. You can do the following operation on the array any number of times (possibly zero):
leetcode.cn 2025-03-20
🔴2612.minimum-reverse-operations
🏷️ Tags
#breadth_first_search #array #ordered_set
🔴2612.minimum-reverse-operations
🏷️ Tags
#breadth_first_search #array #ordered_set
Telegraph
minimum-reverse-operations
给你一个整数 n 和一个在范围 [0, n - 1] 以内的整数 p ,它们表示一个长度为 n 且下标从 0 开始的数组 arr ,数组中除了下标为 p 处是 1 以外,其他所有数都是 0 。 同时给你一个整数数组 banned ,它包含数组中的一些位置。banned 中第 i 个位置表示 arr[banned[i]] = 0 ,题目保证 banned[i] != p 。 你可以对 arr 进行 若干次 操作。一次操作中,你选择大小为 k 的一个 子数组 ,并将它 翻转 。在任何一次翻转操作后,你都需要确保…
leetcode.com 2025-03-20
🔴3108.minimum-cost-walk-in-weighted-graph
🏷️ Tags
#bit_manipulation #union_find #graph #array
🔴3108.minimum-cost-walk-in-weighted-graph
🏷️ Tags
#bit_manipulation #union_find #graph #array
Telegraph
minimum-cost-walk-in-weighted-graph
There is an undirected weighted graph with n vertices labeled from 0 to n - 1. You are given the integer n and an array edges, where edges[i] = [ui, vi, wi] indicates that there is an edge between vertices ui and vi with a weight of wi. A walk on a graph…
👍1
leetcode.com 2025-03-21
🟡2115.find-all-possible-recipes-from-given-supplies
🏷️ Tags
#graph #topological_sort #array #hash_table #string
🟡2115.find-all-possible-recipes-from-given-supplies
🏷️ Tags
#graph #topological_sort #array #hash_table #string
Telegraph
find-all-possible-recipes-from-given-supplies
You have information about n different recipes. You are given a string array recipes and a 2D string array ingredients. The ith recipe has the name recipes[i], and you can create it if you have all the needed ingredients from ingredients[i]. A recipe can…
leetcode.com 2025-03-22
🟡2685.count-the-number-of-complete-components
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #graph
🟡2685.count-the-number-of-complete-components
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #graph
Telegraph
count-the-number-of-complete-components
You are given an integer n. There is an undirected graph with n vertices, numbered from 0 to n - 1. You are given a 2D integer array edges where edges[i] = [ai, bi] denotes that there exists an undirected edge connecting vertices ai and bi. Return the number…
leetcode.cn 2025-03-25
🟡2711.difference-of-number-of-distinct-values-on-diagonals
🏷️ Tags
#array #hash_table #matrix
🟡2711.difference-of-number-of-distinct-values-on-diagonals
🏷️ Tags
#array #hash_table #matrix
Telegraph
difference-of-number-of-distinct-values-on-diagonals
给你一个下标从 0 开始、大小为 m x n 的二维矩阵 grid ,请你求解大小同样为 m x n 的答案矩阵 answer 。 矩阵 answer 中每个单元格 (r, c) 的值可以按下述方式进行计算: