leetcode.cn 2025-02-27
🔴2296.design-a-text-editor
🏷️ Tags
#stack #design #linked_list #string #doubly_linked_list #simulation
🔴2296.design-a-text-editor
🏷️ Tags
#stack #design #linked_list #string #doubly_linked_list #simulation
Telegraph
design-a-text-editor
请你设计一个带光标的文本编辑器,它可以实现以下功能:
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-29
🔴2818.apply-operations-to-maximize-score
🏷️ Tags
#stack #greedy #array #math #number_theory #sorting #monotonic_stack
🔴2818.apply-operations-to-maximize-score
🏷️ Tags
#stack #greedy #array #math #number_theory #sorting #monotonic_stack
Telegraph
apply-operations-to-maximize-score
You are given an array nums of n positive integers and an integer k. Initially, you start with a score of 1. You have to maximize your score by applying the following operation at most k times:
leetcode.cn 2025-06-06
🟡2434.using-a-robot-to-print-the-lexicographically-smallest-string
🏷️ Tags
#stack #greedy #hash_table #string
🟡2434.using-a-robot-to-print-the-lexicographically-smallest-string
🏷️ Tags
#stack #greedy #hash_table #string
Telegraph
using-a-robot-to-print-the-lexicographically-smallest-string
给你一个字符串 s 和一个机器人,机器人当前有一个空字符串 t 。执行以下操作之一,直到 s 和 t 都变成空字符串:
leetcode.com 2025-06-06
🟡2434.using-a-robot-to-print-the-lexicographically-smallest-string
🏷️ Tags
#stack #greedy #hash_table #string
🟡2434.using-a-robot-to-print-the-lexicographically-smallest-string
🏷️ Tags
#stack #greedy #hash_table #string
Telegraph
using-a-robot-to-print-the-lexicographically-smallest-string
You are given a string s and a robot that currently holds an empty string t. Apply one of the following operations until s and t are both empty:
leetcode.cn 2025-06-07
🟡3170.lexicographically-minimum-string-after-removing-stars
🏷️ Tags
#stack #greedy #hash_table #string #heap_priority_queue
🟡3170.lexicographically-minimum-string-after-removing-stars
🏷️ Tags
#stack #greedy #hash_table #string #heap_priority_queue
Telegraph
lexicographically-minimum-string-after-removing-stars
给你一个字符串 s 。它可能包含任意数量的 '*' 字符。你的任务是删除所有的 '*' 字符。 当字符串还存在至少一个 '*' 字符时,你可以执行以下操作:
leetcode.com 2025-06-07
🟡3170.lexicographically-minimum-string-after-removing-stars
🏷️ Tags
#stack #greedy #hash_table #string #heap_priority_queue
🟡3170.lexicographically-minimum-string-after-removing-stars
🏷️ Tags
#stack #greedy #hash_table #string #heap_priority_queue
Telegraph
lexicographically-minimum-string-after-removing-stars
You are given a string s. It may contain any number of '*' characters. Your task is to remove all '*' characters. While there is a '*', do the following operation:
leetcode.cn 2025-08-21
🟡1504.count-submatrices-with-all-ones
🏷️ Tags
#stack #array #dynamic_programming #matrix #monotonic_stack
🟡1504.count-submatrices-with-all-ones
🏷️ Tags
#stack #array #dynamic_programming #matrix #monotonic_stack
Telegraph
count-submatrices-with-all-ones
给你一个 m x n 的二进制矩阵 mat ,请你返回有多少个 子矩形 的元素全部都是 1 。 示例 1: 输入:mat = [[1,0,1],[1,1,0],[1,1,0]] 输出:13 解释:有 6 个 1x1 的矩形。 有 2 个 1x2 的矩形。 有 3 个 2x1 的矩形。 有 1 个 2x2 的矩形。 有 1 个 3x1 的矩形。 矩形数目总共 = 6 + 2 + 3 + 1 + 1 = 13 。 示例 2: 输入:mat = [[0,1,1,0],[0,1,1,1],[1,1,1,0]]…
leetcode.com 2025-08-21
🟡1504.count-submatrices-with-all-ones
🏷️ Tags
#stack #array #dynamic_programming #matrix #monotonic_stack
🟡1504.count-submatrices-with-all-ones
🏷️ Tags
#stack #array #dynamic_programming #matrix #monotonic_stack
Telegraph
count-submatrices-with-all-ones
Given an m x n binary matrix mat, return the number of submatrices that have all ones. Example 1: Input: mat = [[1,0,1],[1,1,0],[1,1,0]] Output: 13 Explanation: There are 6 rectangles of side 1x1. There are 2 rectangles of side 1x2. There are 3 rectangles…
leetcode.cn 2025-09-16
🔴2197.replace-non-coprime-numbers-in-array
🏷️ Tags
#stack #array #math #number_theory
🔴2197.replace-non-coprime-numbers-in-array
🏷️ Tags
#stack #array #math #number_theory
Telegraph
replace-non-coprime-numbers-in-array
给你一个整数数组 nums 。请你对数组执行下述操作:
leetcode.com 2025-09-16
🔴2197.replace-non-coprime-numbers-in-array
🏷️ Tags
#stack #array #math #number_theory
🔴2197.replace-non-coprime-numbers-in-array
🏷️ Tags
#stack #array #math #number_theory
Telegraph
replace-non-coprime-numbers-in-array
You are given an array of integers nums. Perform the following steps:
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-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…