3414. Maximum Score of Non-overlapping Intervals

Problem You are given a 2D integer array intervals, where intervals[i] = [lᵢ, rᵢ, weightᵢ]. Interval i starts at position lᵢ ...

hard

3298. Count Substrings That Can Be Rearranged to Contain a String II

Problem 跟 3297. Count Substrings That Can Be Rearranged to Contain a String I 一模一样,只是多了一个注意点: Note that the memory limits in ...

hard

3410. Maximize Subarray Sum After Removing All Occurrences of One Element

Problem You are given an integer array nums. You can do the following operation on the array at most once: Choose any intege...

hard

3045. Count Prefix and Suffix Pairs II

Problem 跟 3042. Count Prefix and Suffix Pairs I 一模一样,但单词数量从 50 提升到 10⁵,同时单词的长度也从 10 提升到 10⁵。 https://leetcode.com/problems/co...

hard

3395. Subsequences with a Unique Middle Mode I

Problem 唯一中间众数子序列。 Given an integer array nums, find the number of subsequences of size 5 of nums with a unique middle mode...

hard

3399. Smallest Substring With Identical Characters II

跟 3398. Smallest Substring With Identical Characters I 一模一样,只不过 s 的长度上限从 1000 增加到 10⁵。 https://leetcode.com/problems/smallest...

hard

3398. Smallest Substring With Identical Characters I

Problem You are given a binary string s of length n and an integer numOps. You are allowed to perform the following operation...

hard

3405. Count the Number of Arrays with K Matching Adjacent Elements

Problem You are given three integers n, m, k. A good array arr of size n is defined as follows: Each element in arr is in th...

hard

732. My Calendar III

Problem A k-booking happens when k events have some non-empty intersection (i.e., there is some time that is common to all k ...

hard

730. Count Different Palindromic Subsequences

Problem Given a string s, return the number of different non-empty palindromic subsequences in s. Since the answer may be ver...

hard

913. Cat and Mouse

Problem A game on an undirected graph is played by two players, Mouse and Cat, who alternate turns. The graph is given as fol...

hard

321. Create Maximum Number

Problem You are given two integer arrays nums1 and nums2 of lengths m and n respectively. nums1 and nums2 represent the digit...

hard todo

843. Guess the Word

Problem You are given an array of unique strings words where words[i] is six letters long. One word of words was chosen as a ...

hard

1639. Number of Ways to Form a Target String Given a Dictionary

Problem You are given a list of strings of the same length words and a string target. Your task is to form target using the g...

hard

1206. Design Skiplist

Problem Design a Skiplist without using any built-in libraries. A skiplist is a data structure that takes O(log(n)) time to a...

hard

1250. Check If It Is a Good Array

Problem Given an array nums of positive integers. Your task is to select some subset of nums, multiply each element by an int...

hard

1298. Maximum Candies You Can Get from Boxes

Problem You have n boxes labeled from 0 to n - 1. You are given four arrays: status, candies, keys, and containedBoxes where:...

hard

689. Maximum Sum of 3 Non-Overlapping Subarrays

Problem Given an integer array nums and an integer k, find three non-overlapping subarrays of length k with maximum sum and r...

hard

2493. Divide Nodes Into the Maximum Number of Groups

Problem You are given a positive integer n representing the number of nodes in an undirected graph. The nodes are labeled fro...

hard

3219. Minimum Cost for Cutting Cake II

跟 3218. Minimum Cost for Cutting Cake I 一模一样,只不过 m 和 n 的量级从 20 增加到 10⁵,因此只能用 O(n log n) 贪心解法。 https://leetcode.cn/problems/mi...

hard

3218. Minimum Cost for Cutting Cake I

Problem There is an m x n cake that needs to be cut into 1 x 1 pieces. You are given integers m, n, and two arrays: horizont...

medium hard

2360. Longest Cycle in a Graph

Problem You are given a directed graph of n nodes numbered from 0 to n - 1, where each node has at most one outgoing edge. Th...

hard

2608. Shortest Cycle in a Graph

Problem There is a bi-directional graph with n vertices, where each vertex is labeled from 0 to n - 1. The edges in the graph...

hard

3203. Find Minimum Diameter After Merging Two Trees

Problem There exist two undirected trees with n and m nodes, numbered from 0 to n - 1 and from 0 to m - 1, respectively. You ...

hard

2127. Maximum Employees to Be Invited to a Meeting

Problem A company is organizing a meeting and has a list of n employees, waiting to be invited. They have arranged for a larg...

hard

685. Redundant Connection II

Problem In this problem, a rooted tree is a directed graph such that, there is exactly one node (the root) for which all othe...

hard

1591. Strange Printer II

Problem There is a strange printer with the following two special requirements: On each turn, the printer will print a solid...

hard

2940. Find Building Where Alice and Bob Can Meet

Problem You are given a 0-indexed array heights of positive integers, where heights[i] represents the height of the iᵗʰ build...

hard

664. Strange Printer

Problem There is a strange printer with the following two special properties: The printer can only print a sequence of the s...

hard

1610. Maximum Number of Visible Points

Problem You are given an array points, an integer angle, and your location, where location = [pos_x, pos_y] and points[i] = [...

hard

2872. Maximum Number of K-Divisible Components

Problem There is an undirected tree with n nodes labeled from 0 to n - 1. You are given the integer n and a 2D integer array ...

hard

770. Basic Calculator IV

Problem Given an expression such as expression = "e + 8 - a + 5" and an evaluation map such as {"e":...

hard
123