460. LFU Cache
Design and implement a data structure for a Least Frequently Used (LFU) cache. Implement the LFUCache class: LFUCache(int capacity) Initializes...
352. Data Stream as Disjoint Intervals
Given a data stream input of non-negative integers a1, a2, ..., an, summarize the numbers seen so far as a...
472. Concatenated Words
Given an array of strings words (without duplicates), return all the concatenated words in the given list of words. A...
787. Cheapest Flights Within K Stops
There are n cities connected by some number of flights. You are given an array flights where flights[i] = [fromi,...
2359. Find Closest Node to Given Two Nodes
You are given a directed graph of n nodes numbered from 0 to n - 1, where each node has...
909. Snakes and Ladders
You are given an n x n integer matrix board where the cells are labeled from 1 to n2 in...
997. Find the Town Judge
In a town, there are n people labeled from 1 to n. There is a rumor that one of these...
131. Palindrome Partitioning
Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome...
93. Restore IP Addresses
A valid IP address consists of exactly four integers separated by single dots. Each integer is between 0 and 255...
491. Non-decreasing Subsequences
Given an integer array nums, return all the different possible non-decreasing subsequences of the given array with at least two...
974. Subarray Sums Divisible by K
Given an integer array nums and an integer k, return the number of non-empty subarrays that have a sum divisible...
918. Maximum Sum Circular Subarray
Given a circular integer array nums of length n, return the maximum possible sum of a non-empty subarray of nums....
926. Flip String to Monotone Increasing
A binary string is monotone increasing if it consists of some number of 0’s (possibly none), followed by some number...
57. Insert Interval
You are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the start and the end...
2421. Number of Good Paths
There is a tree (i.e. a connected, undirected graph with no cycles) consisting of n nodes numbered from 0 to...
1061. Lexicographically Smallest Equivalent String
You are given two strings of the same length s1 and s2 and a string baseStr. We say s1[i] and...
2246. Longest Path With Different Adjacent Characters
You are given a tree (i.e. a connected, undirected graph that has no cycles) rooted at node 0 consisting of...
1519. Number of Nodes in the Sub-Tree With the Same Label
You are given a tree (i.e. a connected, undirected graph that has no cycles) consisting of n nodes numbered from...
1443. Minimum Time to Collect All Apples in a Tree
Given an undirected tree consisting of n vertices numbered from 0 to n-1, which has some apples in their vertices....
100. Same Tree
Given the roots of two binary trees p and q, write a function to check if they are the same...
144. Binary Tree Preorder Traversal
Given the root of a binary tree, return the preorder traversal of its nodes’ values. Input: root = [1,null,2,3] Output:...
149. Max Points on a Line
Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane, return the maximum...
134. Gas Station
There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i]....
1833. Maximum Ice Cream Bars
It is a sweltering summer day, and a boy wants to buy some ice cream bars. At the store, there...
452. Minimum Number of Arrows to Burst Balloons
There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a...
2244. Minimum Rounds to Complete All Tasks
There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a...
944. Delete Columns to Make Sorted
You are given an array of n strings strs, all of the same length. The strings can be arranged such...
520. Detect Capital
We define the usage of capitals in a word to be right when one of the following cases holds: All...
290. Word Pattern
Given a pattern and a string s, find if s follows the same pattern. Here follow means a full match,...