164. Maximum Gap

Problem Given an integer array nums, return the maximum difference between two successive elements in its sorted form. If the...

medium

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

983. Minimum Cost For Tickets

Problem You have planned some train traveling one year in advance. The days of the year in which you will travel are given as...

medium

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

2466. Count Ways To Build Good Strings

Problem Given the integers zero, one, low, and high, we can construct a string by starting with an empty string, and then at ...

medium

1367. Linked List in Binary Tree

Problem Given a binary tree root and a linked list with head as the first node. Return True if all the elements in the linked...

medium

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

1366. Rank Teams by Votes

Problem In a special ranking system, each voter gives a rank from highest to lowest to all teams participating in the competi...

medium

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

3046. Split the Array

Problem You are given an integer array nums of even length. You have to split the array into two parts nums1 and nums2 such t...

easy

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

785. Is Graph Bipartite?

Problem There is an undirected graph with n nodes, where each node is numbered between 0 and n - 1. You are given a 2D array ...

medium

1014. Best Sightseeing Pair

Problem You are given an integer array values where values[i] represents the value of the iᵗʰ sightseeing spot. Two sightseei...

medium

3159. Find Occurrences of an Element in an Array

Problem You are given an integer array nums, an integer array queries, and an integer x. For each queries[i], you need to fin...

medium

494. Target Sum

Problem You are given an integer array nums and an integer target. You want to build an expression out of nums by adding one ...

medium

3083. Existence of a Substring in a String and Its Reverse

Problem Given a string s, find any substring of length 2 which is also present in the reverse of s. A substring is a contigu...

easy

515. Find Largest Value in Each Tree Row

Problem Given the root of a binary tree, return an array of the largest value in each row of the tree (0-indexed). https://le...

medium

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

1705. Maximum Number of Eaten Apples

Problem There is a special kind of apple tree that grows apples every day for n days. On the iᵗʰ day, the tree grows apples[i...

medium

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

721. Accounts Merge

Problem Given a list of accounts where each element accounts[i] is a list of strings, where the first element accounts[i][0] ...

medium

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

2471. Minimum Number of Operations to Sort a Binary Tree by Level

Problem You are given the root of a binary tree with unique values. In one operation, you can choose any two nodes at the sam...

medium
12345610