652. Find Duplicate Subtrees
Given the root of a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only need...
427. Construct Quad Tree
Given a n \* n matrix grid of 0's and 1's only. We want to represent the grid with a...
72. Edit Distance
Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2. You have...
121. Best Time to Buy and Sell Stock
You are given an array prices where prices[i] is the price of a given stock on the ith day. You...
1675. Minimize Deviation in Array
You are given an array nums of n positive integers. You can perform two types of operations on any element...
502. IPO
Suppose LeetCode will start its IPO soon. In order to sell a good price of its shares to Venture Capital,...
1011. Capacity To Ship Packages Within D Days
A conveyor belt has packages that must be shipped from one port to another within days days. The ith package...
540. Single Element in a Sorted Array
You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element...
35. Search Insert Position
Given a sorted array of distinct integers and a target value, return the index if the target is found. If...
103. Binary Tree Zigzag Level Order Traversal
Given the root of a binary tree, return the zigzag level order traversal of its nodes’ values. (i.e., from left...
226. Invert Binary Tree
Given the root of a binary tree, invert the tree, and return its root. Example Input: root = [4, 2,...
783. Minimum Distance Between BST Nodes
Given the root of a Binary Search Tree (BST), return the minimum difference between the values of any two different...
104. Maximum Depth of Binary Tree
Given the root of a binary tree, return its maximum depth. A binary tree’s maximum depth is the number of...
989. Add to Array-Form of Integer
The array-form of an integer num is an array representing its digits in left to right order. For example, for...
67. Add Binary
Given two binary strings a and b, return their sum as a binary string. Example Input: a = "11", b...
1523. Count Odd Numbers in an Interval Range
Given two non-negative integers low and high. Return the count of odd numbers between low and high (inclusive). Example Input:...
2477. Minimum Fuel Cost to Report to the Capital
There is a tree (i.e., a connected, undirected graph with no cycles) structure country network consisting of n cities numbered...
1129. Shortest Path with Alternating Colors
You are given an integer n, the number of nodes in a directed graph where the nodes are labeled from...
1162. As Far from Land as Possible
Given an n x n grid containing only values 0 and 1, where 0 represents water and 1 represents land,...
2306. Naming a Company
You are given an array of strings ideas that represents a list of names to be used in the process...
45. Jump Game II
You are given a 0-indexed array of integers nums of length n. You are initially positioned at nums[0]. Each element...
904. Fruit Into Baskets
You are visiting a farm that has a single row of fruit trees arranged from left to right. The trees...
1470. Shuffle the Array
Given the array nums consisting of 2n elements in the form [x1,x2,...,xn,y1,y2,...,yn]. Return the array in the form [x1,y1,x2,y2,...,xn,yn]. Example:...
438. Find All Anagrams in a String
Given two strings s and p, return an array of all the start indices of p’s anagrams in s. You...
567. Permutation in String
Given two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise. In other...
6. Zigzag Conversion
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want...
953. Verifying an Alien Dictionary
In an alien language, surprisingly, they also use English lowercase letters, but possibly in a different order. The order of...
1071. Greatest Common Divisor of Strings
For two strings s and t, we say “t divides s” if and only if s = t + ......
1626. Best Team With No Conflicts
You are the manager of a basketball team. For the upcoming tournament, you want to choose the team with the...
1137. N-th Tribonacci Number
The Tribonacci sequence Tn is defined as follows: T0 = 0, T1 = 1, T2 = 1, and Tn+3 =...