224. Basic Calculator

Problem Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result ...

hard

3389. Minimum Operations to Make Character Frequencies Equal

Problem You are given a string s. A string t is called good if all characters of t occur the same number of times. You can pe...

hard

188. Best Time to Buy and Sell Stock IV

Problem You are given an integer array prices where prices[i] is the price of a given stock on the iᵗʰ day, and an integer k....

hard

3213. Construct String with Minimum Cost

Problem You are given a string target, an array of strings words, and an integer array costs, both arrays of the same length....

hard difficult

3292. Minimum Number of Valid Strings to Form Target II

3291. Minimum Number of Valid Strings to Form Target I 的进阶版,题目一模一样,但 words 的长度从 5 * 10³ 增加到 5 * 10⁵,target 的长度从 5 * 10³ 增加到 5...

hard

3291. Minimum Number of Valid Strings to Form Target I

Problem You are given an array of strings words and a string target. A string x is called valid if x is a prefix of any strin...

medium hard

1847. Closest Room

Problem There is a hotel with n rooms. The rooms are represented by a 2D integer array rooms where rooms[i] = [roomIdᵢ, sizeᵢ...

hard

123. Best Time to Buy and Sell Stock III

Problem You are given an array prices where prices[i] is the price of a given stock on the iᵗʰ day. Find the maximum profit y...

hard

2809. Minimum Time to Make Array Sum At Most x

Problem You are given two 0-indexed integer arrays nums1 and nums2 of equal length. Every second, for all indices 0 <= i &...

hard difficult

3266. Final Array State After K Multiplication Operations II

Problem You are given an integer array nums, an integer k, and an integer multiplier. You need to perform k operations on num...

hard

2931. Maximum Spending After Buying Items

Problem You are given a 0-indexed m * n integer matrix values, representing the values of m * n different items in m differen...

hard

2699. Modify Graph Edge Weights

Problem You are given an undirected weighted connected graph containing n nodes labeled from 0 to n - 1, and an integer array...

hard difficult

1719. Number Of Ways To Reconstruct A Tree

Problem You are given an array pairs, where pairs[i] = [xᵢ, yᵢ], and: There are no duplicates. xᵢ < yᵢ Let ways be the n...

hard difficult todo

1982. Find Array Given Subset Sums

Problem You are given an integer n representing the length of an unknown array that you are trying to recover. You are also g...

hard difficult

782. Transform to Chessboard

Problem You are given an n x n binary grid board. In each move, you can swap any two rows with each other, or any two columns...

hard

2056. Number of Valid Move Combinations On Chessboard

Problem There is an 8 x 8 chessboard containing n pieces (rooks, queens, or bishops). You are given a string array pieces of ...

hard

52. N-Queens II

Problem The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each oth...

hard

1531. String Compression II

Problem Run-length encoding is a string compression method that works by replacing consecutive identical characters (repeated...

hard difficult

51. N-Queens

Problem The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each oth...

hard

2097. Valid Arrangement of Pairs

Problem You are given a 0-indexed 2D integer array pairs where pairs[i] = [startᵢ, endᵢ]. An arrangement of pairs is valid if...

hard todo

2577. Minimum Time to Visit a Cell In a Grid

Problem You are given a m x n matrix grid consisting of non-negative integers where grid[row][col] represents the minimum tim...

hard

3251. Find the Count of Monotonic Pairs II

跟 3250. Find the Count of Monotonic Pairs I 一模一样,只不过 nums[i] 的上限从 50 增加到 1000。 https://leetcode.cn/problems/find-the-count-of...

hard

3250. Find the Count of Monotonic Pairs I

Problem You are given an array of positive integers nums of length n. We call a pair of non-negative integer arrays (arr1, ar...

hard

2290. Minimum Obstacle Removal to Reach Corner

Problem You are given a 0-indexed 2D integer array grid of size m x n. Each cell has one of two values: 0 represents an empt...

hard

124. Binary Tree Maximum Path Sum

Problem A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecti...

hard

632. Smallest Range Covering Elements from K Lists

Problem You have k lists of sorted integers in non-decreasing order. Find the smallest range that includes at least one numbe...

hard

212. Word Search II

Problem Given an m x n board of characters and a list of strings words, return all words on the board. Each word must be cons...

hard

76. Minimum Window Substring

Problem Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every c...

hard

3244. Shortest Distance After Road Addition Queries II

Problem You are given an integer n and a 2D integer array queries. There are n cities numbered from 0 to n - 1. Initially, th...

hard

300. Longest Increasing Subsequence

Problem Given an integer array nums, return the length of the longest strictly increasing subsequence. A subsequence is an a...

medium hard

297. Serialize and Deserialize Binary Tree

Problem Serialization is the process of converting a data structure or object into a sequence of bits so that it can be store...

hard

295. Find Median from Data Stream

Problem The median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value,...

hard
123