Problem library
All problems
A searchable reference of every problem I have solved, with categories and complexity at a glance.
944
/ 944 problems
| Problem | Category | Time | Solved |
|---|---|---|---|
|
Lowest common ancestor of a binary tree IV
tree
|
O(n) | Aug 7, 2023 | |
|
Split strings by separator
array-and-hashmap
|
O(n) | Jul 24, 2023 | |
|
Number of increasing paths in a grid
dynamic-programming
graph
|
O(m*n) | Jun 17, 2023 | |
|
Missing ranges
array-and-hashmap
|
O(n) | Jun 14, 2023 | |
|
Check if all characters have equal number of occurrences
array-and-hashmap
|
O(n) | Jun 13, 2023 | |
|
Summary ranges
array-and-hashmap
|
O(n) | Jun 11, 2023 | |
|
Maximum value at a given index in a bounded array
binary-search
|
O(log(n)) | Jun 9, 2023 | |
|
Check if a number is majority element in a sorted array
binary-search
|
O(n) | Jun 7, 2023 | |
|
Count negative numbers in a sorted matrix
array-and-hashmap
|
O(n) | Jun 7, 2023 | |
|
Can make arithmetic progression from sequence
math-and-geometry
array-and-hashmap
|
O(nlog(n)) | Jun 5, 2023 | |
|
Check if it is a straight line
math-and-geometry
|
O(n) | Jun 4, 2023 | |
|
Time needed to inform all employees
graph
|
O(n) | Jun 2, 2023 | |
|
Shortest path in binary matrix
graph
|
O(n) | Jun 1, 2023 | |
|
Number of substrings containing all three characters
sliding-window
|
O(n) | May 28, 2023 | |
|
Vowels of all substrings
dynamic-programming
|
O(n) | May 28, 2023 | |
|
Stone game II
dynamic-programming
|
O(n^2) | May 27, 2023 | |
|
Stone game III
dynamic-programming
|
O(n) | May 27, 2023 | |
|
Univalued binary tree
tree
|
O(n) | May 27, 2023 | |
|
Count vowel strings in ranges
array-and-hashmap
|
O(n) | May 24, 2023 | |
|
Left and right sum differences
array-and-hashmap
|
O(n) | May 24, 2023 | |
|
Maximum subsequence score
heap
|
O(nlog(n)) | May 23, 2023 | |
|
Sum in a matrix
math-and-geometry
|
O(nmlog(m)) | May 23, 2023 | |
|
Find three consecutive integers that sum to a given number
math-and-geometry
|
O(1) | May 22, 2023 | |
|
Split a circular linked list
linked-list
|
O(n) | May 22, 2023 | |
|
Kth largest sum in a binary tree
heap
tree
|
O(nlog(k)) | May 21, 2023 | |
|
K-th smallest prime fraction
heap
|
O(klog(n)) | May 20, 2023 | |
|
Maximum profit from trading stocks
dynamic-programming
|
O(n) | May 20, 2023 | |
|
Check if word equals summation of two words
array-and-hashmap
|
O(n) | May 19, 2023 | |
|
The kth factor of n
math-and-geometry
|
O(n) | May 19, 2023 | |
|
Number of adjacent elements with the same color
array-and-hashmap
|
O(n) | May 18, 2023 | |
|
Diameter of N-ary tree
tree
|
O(n) | May 17, 2023 | |
|
Number of good leaf nodes pairs
tree
|
O(n^2) | May 17, 2023 | |
|
Remove sub folders from the filesystem
trie
|
O(n * m) | May 15, 2023 | |
|
Consecutive characters
array-and-hashmap
|
O(n) | May 14, 2023 | |
|
Count triplets that can form two arrays of equal xor
bit-manipulation
|
O(n^2) | May 13, 2023 | |
|
Make array zero by subtracting equal amounts
heap
math-and-geometry
|
O(nlogn) | May 13, 2023 | |
|
Maximum product of two elements in an array
heap
|
O(n) | May 13, 2023 | |
|
Android unlock patterns
backtracking
|
O(n!) | May 12, 2023 | |
|
Count ways to build good strings
dynamic-programming
|
O(n) | May 12, 2023 | |
|
Find permutation
array-and-hashmap
|
O(n) | May 12, 2023 | |
|
Letter tile possibilities
backtracking
|
O(n!) | May 12, 2023 | |
|
Maximum length of subarray with positive product
dynamic-programming
|
O(n) | May 11, 2023 | |
|
Solving questions with brainpower
dynamic-programming
|
O(n) | May 11, 2023 | |
|
Equal tree partition
tree
|
O(n) | May 10, 2023 | |
|
Largest unique number
array-and-hashmap
|
O(n) | May 10, 2023 | |
|
Uncrossed lines
dynamic-programming
|
O(m*n) | May 10, 2023 | |
|
Increasing order search tree
tree
|
O(n) | May 9, 2023 | |
|
Prime in diagonal
array-and-hashmap
|
O(n) | May 8, 2023 | |
|
Valid boomerang
math-and-geometry
|
O(1) | May 8, 2023 | |
|
Matrix diagonal sum
array-and-hashmap
|
O(n) | May 7, 2023 | |
|
Sort array by increasing frequency
array-and-hashmap
|
O(nlog(n)) | May 7, 2023 | |
|
Concatenation of array
array-and-hashmap
|
O(n) | May 6, 2023 | |
|
Find score of an array after marking all elements
heap
|
O(nlog(n)) | May 6, 2023 | |
|
Find the longest valid obstacle course at each position
binary-search
|
O(nlogn) | May 6, 2023 | |
|
Maximum number of vowels in a substring of given length
array-and-hashmap
|
O(n) | May 5, 2023 | |
|
Substrings that begin and end with the same letter
array-and-hashmap
math-and-geometry
|
O(n) | May 5, 2023 | |
|
Index pairs of a string
array-and-hashmap
|
O(n^2) | May 4, 2023 | |
|
Maximum sum with exactly k elements
array-and-hashmap
|
O(k) | May 4, 2023 | |
|
Greatest common divisor of strings
math-and-geometry
|
O(n) | Feb 1, 2023 | |
|
Sentence similarity
array-and-hashmap
graph
|
O(n) | Feb 1, 2023 | |
|
Best team with no conflicts
dynamic-programming
|
O(n^2) | Jan 31, 2023 | |
|
Game of nim
bit-manipulation
|
O(n) | Jan 29, 2023 | |
|
LFU cache
linked-list
design
|
O(1) | Jan 29, 2023 | |
|
Data stream as disjoint intervals
intervals
|
O(n) | Jan 28, 2023 | |
|
Concatenated words
trie
|
O(n^2) | Jan 27, 2023 | |
|
Find closest node to given two nodes
graph
|
O(n) | Jan 25, 2023 | |
|
Find minimum time to finish all jobs II
greedy
|
O(nlog(n)) | Jan 24, 2023 | |
|
Queue reconstruction by height
greedy
|
O(nlog(n)) | Jan 23, 2023 | |
|
Confusing number II
backtracking
|
O(5^log(n)) | Jan 22, 2023 | |
|
Candy
array-and-hashmap
|
O(n) | Jan 21, 2023 | |
|
Subarray sums divisible by k
array-and-hashmap
|
O(n) | Jan 19, 2023 | |
|
Count the number of good subarray
sliding-window
|
O(n) | Jan 18, 2023 | |
|
Find the celebrity
two-pointers
|
O(n) | Jan 17, 2023 | |
|
Flip string to monotone increasing
array-and-hashmap
|
O(n) | Jan 17, 2023 | |
|
Minimum moves to reach target score
greedy
|
O(log(n)) | Jan 16, 2023 | |
|
Percentage of letter in string
array-and-hashmap
|
O(n) | Jan 16, 2023 | |
|
Difference between element sum and digit sum of an array
array-and-hashmap
|
O(n) | Jan 15, 2023 | |
|
Find the index of the large integer
binary-search
|
O(log(n)) | Jan 15, 2023 | |
|
Number of good paths
tree
|
O(nlog(n)) | Jan 15, 2023 | |
|
Lexicographically smallest equivalent string
graph
|
O(n) | Jan 14, 2023 | |
|
Longest path with different adjacent characters
tree
|
O(n) | Jan 13, 2023 | |
|
Number of good binary strings
dynamic-programming
|
O(n) | Jan 13, 2023 | |
|
Number of nodes in the sub tree with the same label
tree
|
O(n) | Jan 12, 2023 | |
|
Maximum binary string after change
greedy
|
O(n) | Jan 11, 2023 | |
|
Maximum number of points with cost
dynamic-programming
|
O(mn) | Jan 11, 2023 | |
|
Minimum time to collect all apples in a tree
tree
graph
|
O(n) | Jan 11, 2023 | |
|
Find good days to rob the bank
array-and-hashmap
|
O(n) | Jan 10, 2023 | |
|
Shuffle the array
array-and-hashmap
|
O(n) | Jan 10, 2023 | |
|
Confusing number
array-and-hashmap
|
O(log(n)) | Jan 9, 2023 | |
|
Find and replace in string
array-and-hashmap
|
O(n) | Jan 9, 2023 | |
|
Maximal score after applying k operations
heap
|
O(klog(n)) | Jan 9, 2023 | |
|
Find xor beauty of array
bit-manipulation
|
O(n) | Jan 8, 2023 | |
|
Max points on a line
math-and-geometry
|
O(n^2) | Jan 8, 2023 | |
|
Minimum health to beat game
greedy
|
O(n) | Jan 8, 2023 | |
|
Assign cookies
greedy
|
O(nlog(n)) | Jan 7, 2023 | |
|
Max increase to keep city skyline
greedy
|
O(n^2) | Jan 6, 2023 | |
|
Maximum ice cream bars
greedy
heap
|
O(nlog(n)) | Jan 6, 2023 | |
|
Minimum operations to make the array alternating
greedy
array-and-hashmap
|
O(n) | Jan 6, 2023 | |
|
Most profit assigning work
greedy
two-pointers
|
O(nlog(n)) | Jan 6, 2023 | |
|
Number of segments in a string
array-and-hashmap
|
O(n) | Jan 5, 2023 | |
|
Steps to make array non decreasing
stack
dynamic-programming
|
O(n) | Jan 5, 2023 | |
|
Check if number is a sum of powers of three
math-and-geometry
|
O(log(n)) | Jan 4, 2023 | |
|
Check if there is a valid path in a grid
graph
|
O(mn) | Jan 4, 2023 | |
|
Convert to base -2
math-and-geometry
|
O(log(n)) | Jan 4, 2023 | |
|
Delete columns to make sorted
array-and-hashmap
|
O(nm) | Jan 3, 2023 | |
|
Finding the number of visible mountains
stack
|
O(nlog(n)) | Jan 3, 2023 | |
|
Car pooling
array-and-hashmap
|
O(nlogn) | Jan 2, 2023 | |
|
Divide intervals into minimum number of groups
heap
intervals
|
O(nlogn) | Jan 2, 2023 | |
|
K highest ranked items within a price range
heap
graph
|
O(mnlog(mn)) | Jan 2, 2023 | |
|
Count the digits that divide a number
math-and-geometry
|
O(n) | Jan 1, 2023 | |
|
Count the number of k big indices
binary-search
|
O(nlog(n)) | Jan 1, 2023 | |
|
Distinct prime factors of product of array
math-and-geometry
|
O(nlog(n)) | Jan 1, 2023 | |
|
Sum of all odd length subarrays
array-and-hashmap
|
O(n^3) | Jan 1, 2023 | |
|
Two sum bsts
tree
|
O(n) | Jan 1, 2023 | |
|
Create binary tree from descriptions
tree
|
O(n) | Dec 31, 2022 | |
|
Sum of all subset xor totals
backtracking
|
O(n*2^n) | Dec 31, 2022 | |
|
Unique paths III
backtracking
|
O(n^2) | Dec 31, 2022 | |
|
3sum smaller
array-and-hashmap
|
O(n^2) | Dec 30, 2022 | |
|
adding-spaces-to-a-string
array-and-hashmap
|
O(n) | Dec 30, 2022 | |
|
Remove letter to equalize frequency
array-and-hashmap
|
O(n) | Dec 30, 2022 | |
|
Leftmost column with at least a one
binary-search
|
O(mlog(n)) | Dec 29, 2022 | |
|
Count number of ways to place houses
math-and-geometry
|
O(n) | Dec 28, 2022 | |
|
Design a leaderboard
array-and-hashmap
design
|
O(1) | Dec 28, 2022 | |
|
Maximum tastiness of candy basket
binary-search
|
O(nlog(n)) | Dec 28, 2022 | |
|
Minimum increment to make array unique
greedy
|
O(nlog(n)) | Dec 28, 2022 | |
|
Minimum path cost in a grid
dynamic-programming
|
O(nm) | Dec 28, 2022 | |
|
Minimum penalty for a shop
array-and-hashmap
greedy
|
O(n) | Dec 28, 2022 | |
|
Minimum remove to make valid parentheses
stack
|
O(n) | Dec 28, 2022 | |
|
First day where you have been in all the rooms
dynamic-programming
|
O(n) | Dec 27, 2022 | |
|
Maximum bags with full capacity of rocks
greedy
|
O(nlog(n)) | Dec 27, 2022 | |
|
Next palindrome using same digits
math-and-geometry
|
O(n) | Dec 27, 2022 | |
|
Perfect number
math-and-geometry
|
O(sqrt(n)) | Dec 27, 2022 | |
|
Prefix and suffix search
array-and-hashmap
design
|
O(n) | Dec 27, 2022 | |
|
Synonymous sentences
graph
|
O(n^2) | Dec 27, 2022 | |
|
XOR operation in an array
bit-manipulation
|
O(n) | Dec 27, 2022 | |
|
Bitwise or of all subsequence sums
bit-manipulation
|
O(n) | Dec 26, 2022 | |
|
Out of boundary paths
dynamic-programming
|
O(mn) | Dec 26, 2022 | |
|
Shortest unsorted continuous subarray
greedy
|
O(nlog(n)) | Dec 26, 2022 | |
|
Count anagrams
math-and-geometry
|
O(n) | Dec 25, 2022 | |
|
Longest subsequence with limited sum
array-and-hashmap
|
O(nlog(n)) | Dec 25, 2022 | |
|
Minimum number of moves to make palindrome
two-pointers
|
O(n^2) | Dec 25, 2022 | |
|
Most popular video creator
array-and-hashmap
heap
|
O(nlog(n)) | Dec 25, 2022 | |
|
Reward top k students
array-and-hashmap
|
O(nlog(n)) | Dec 25, 2022 | |
|
Take k of each character from left and right
array-and-hashmap
two-pointers
|
O(n) | Dec 25, 2022 | |
|
Beautiful array
array-and-hashmap
|
O(n) | Dec 24, 2022 | |
|
Custom sort string
array-and-hashmap
|
O(n) | Dec 24, 2022 | |
|
Domino and tromino tiling
dynamic-programming
|
O(n) | Dec 24, 2022 | |
|
Number of distinct islands
graph
|
O(mn) | Dec 24, 2022 | |
|
Valid triangle number
greedy
binary-search
|
O(n^2) | Dec 24, 2022 | |
|
Convert binary search tree to sorted doubly linked list
linked-list
tree
|
O(n) | Dec 23, 2022 | |
|
Count good meals
array-and-hashmap
|
O(nlog(n)) | Dec 23, 2022 | |
|
Flatten a multilevel doubly linked list
linked-list
tree
|
O(n) | Dec 23, 2022 | |
|
Check if there is a path with equal number of 0s and 1s
dynamic-programming
|
O(mn) | Dec 22, 2022 | |
|
Largest values from labels
greedy
|
O(nlogn) | Dec 22, 2022 | |
|
Sum of distances in tree
tree
|
O(n) | Dec 22, 2022 | |
|
Find distance in a binary tree
tree
|
O(n) | Dec 21, 2022 | |
|
Largest merge of two strings
greedy
|
O(n+m) | Dec 21, 2022 | |
|
Maximal network rank
graph
|
O(n^2) | Dec 21, 2022 | |
|
Possible bipartition
graph
|
O(n+m) | Dec 21, 2022 | |
|
Backspace string compare
stack
|
O(n+m) | Dec 20, 2022 | |
|
Longest mountain in array
two-pointers
|
O(n) | Dec 20, 2022 | |
|
Minimum initial energy to finish tasks
greedy
|
O(nlog(n)) | Dec 20, 2022 | |
|
Shifting letters
array-and-hashmap
|
O(n) | Dec 20, 2022 | |
|
Ways to make a fair array
array-and-hashmap
|
O(n) | Dec 20, 2022 | |
|
Binary tree longest consecutive sequence
tree
|
O(n) | Dec 19, 2022 | |
|
Check if array pairs are divisible by k
array-and-hashmap
|
O(n) | Dec 19, 2022 | |
|
Clone binary tree with random pointer
tree
|
O(n) | Dec 19, 2022 | |
|
Decode the message
array-and-hashmap
|
O(n) | Dec 19, 2022 | |
|
Delete n nodes after m nodes of a linked list
linked-list
|
O(n) | Dec 19, 2022 | |
|
Maximum number of books you can take
stack
|
O(n) | Dec 19, 2022 | |
|
Path crossing
array-and-hashmap
|
O(n) | Dec 19, 2022 | |
|
Check if there is a valid parentheses string path
dynamic-programming
|
O(n^2) | Dec 18, 2022 | |
|
Day of the year
math-and-geometry
|
O(1) | Dec 18, 2022 | |
|
Pancake sorting
array-and-hashmap
|
O(n^2) | Dec 18, 2022 | |
|
Powerful integers
math-and-geometry
|
O(n^2) | Dec 18, 2022 | |
|
Add two integers
math-and-geometry
|
O(1) | Dec 17, 2022 | |
|
Apply discount to prices
array-and-hashmap
|
O(n) | Dec 17, 2022 | |
|
Maximum sum score of array
array-and-hashmap
|
O(n) | Dec 17, 2022 | |
|
Minimum rounds to complete all tasks
greedy
|
O(n) | Dec 17, 2022 | |
|
Number of boomerangs
array-and-hashmap
|
O(n^2) | Dec 17, 2022 | |
|
Replace elements in an array
array-and-hashmap
|
O(n+m) | Dec 17, 2022 | |
|
Root equals sum of children
tree
|
O(1) | Dec 17, 2022 | |
|
Ternary expression parser
stack
|
O(n) | Dec 17, 2022 | |
|
Encode number
array-and-hashmap
|
O(log(n)) | Dec 16, 2022 | |
|
Number of closed islands
graph
|
O(mn) | Dec 16, 2022 | |
|
Widest pair of indices with equal range sum
array-and-hashmap
|
O(n) | Dec 16, 2022 | |
|
Campus bikes II
dynamic-programming
|
O(2^n) | Dec 15, 2022 | |
|
Append k integers with minimal sum
greedy
|
O(nlog(n)) | Dec 14, 2022 | |
|
Count number of homogenous substrings
array-and-hashmap
|
O(n) | Dec 14, 2022 | |
|
Minimum number of operations to move all balls to each box
array-and-hashmap
|
O(n) | Dec 14, 2022 | |
|
Ugly number III
math-and-geometry
|
O(log(n)) | Dec 14, 2022 | |
|
Check whether two strings are almost equivalent
array-and-hashmap
|
O(n) | Dec 13, 2022 | |
|
Detect capital
array-and-hashmap
|
O(1) | Dec 13, 2022 | |
|
Increasing subsequences
backtracking
|
O(n^2) | Dec 13, 2022 | |
|
Letter case permutation
backtracking
|
O(2^n) | Dec 13, 2022 | |
|
Moving average from data stream
queue
design
|
O(1) | Dec 13, 2022 | |
|
Average waiting time
intervals
array-and-hashmap
|
O(n) | Dec 12, 2022 | |
|
Longest square streak in an array
greedy
|
O(nlog(n)) | Dec 12, 2022 | |
|
Longest univalue path
tree
|
O(n) | Dec 12, 2022 | |
|
Lowest common ancestor of deepest leaves
tree
|
O(n) | Dec 12, 2022 | |
|
Maximum level sum of a binary tree
tree
|
O(n) | Dec 12, 2022 | |
|
Maximum nesting depth of two valid parentheses strings
stack
|
O(n) | Dec 12, 2022 | |
|
Smallest subtree with all the deepest nodes
tree
|
O(n) | Dec 12, 2022 | |
|
Best time to buy and sell stock with transaction fee
dynamic-programming
|
O(n) | Dec 11, 2022 | |
|
Minimum cost to connect sticks
heap
|
O(nlog(n)) | Dec 11, 2022 | |
|
Remove nodes from linked list
linked-list
|
O(n) | Dec 11, 2022 | |
|
Removing stars from a string
stack
|
O(n) | Dec 11, 2022 | |
|
Find the longest substring containing vowels in even counts
array-and-hashmap
|
O(n) | Dec 10, 2022 | |
|
Maximum product of splitted binary tree
tree
|
O(n) | Dec 10, 2022 | |
|
Partition array such that maximum difference is k
greedy
|
O(nlog(n)) | Dec 10, 2022 | |
|
Valid palindrome IV
array-and-hashmap
two-pointers
|
O(n) | Dec 10, 2022 | |
|
Add two polynomials represented as linked lists
linked-list
|
O(n) | Dec 9, 2022 | |
|
Design hit counter
design
queue
|
O(n) | Dec 9, 2022 | |
|
Longest substring with at least k repeating characters
array-and-hashmap
|
O(n) | Dec 9, 2022 | |
|
Maximize the confusion of an exam
sliding-window
|
O(n) | Dec 9, 2022 | |
|
Number of pairs of interchangeable rectangles
array-and-hashmap
|
O(n) | Dec 9, 2022 | |
|
Find root of N-ary tree
tree
|
O(n) | Dec 8, 2022 | |
|
Insert into a sorted circular linked list
linked-list
|
O(n) | Dec 8, 2022 | |
|
Maximum number of non overlapping subarrays with sum equals target
greedy
|
O(n) | Dec 8, 2022 | |
|
Range frequency queries
binary-search
design
|
O(log(n)) | Dec 8, 2022 | |
|
Can you eat your favorite candy on your favorite day
array-and-hashmap
|
O(n) | Dec 7, 2022 | |
|
Design tic tac toe
design
|
O(1) | Dec 7, 2022 | |
|
Maximum size subarray sum equals k
array-and-hashmap
|
O(n) | Dec 7, 2022 | |
|
Minimum cost to buy apples
graph
|
O(nlog(n)) | Dec 7, 2022 | |
|
Number of subarrays having even product
array-and-hashmap
|
O(n) | Dec 7, 2022 | |
|
Range sum of bst
tree
|
O(n) | Dec 7, 2022 | |
|
Words within two edits of dictionary
array-and-hashmap
|
O(n^2) | Dec 7, 2022 | |
|
Alert using same key card three or more times in a one hour period
array-and-hashmap
|
O(nlog(n)) | Dec 6, 2022 | |
|
Describe the painting
array-and-hashmap
|
O(nlog(n)) | Dec 6, 2022 | |
|
Encode and decode strings
design
|
O(n) | Dec 6, 2022 | |
|
largest-bst-subtree
tree
|
O(n^2) | Dec 6, 2022 | |
|
Number of ways to buy pens and pencils
math-and-geometry
|
O(n) | Dec 6, 2022 | |
|
Find center of star graph
graph
|
O(1) | Dec 5, 2022 | |
|
Find k pairs with smallest sums
heap
|
O(klog(n)) | Dec 5, 2022 | |
|
Fraction to recurring decimal
math-and-geometry
|
O(n) | Dec 5, 2022 | |
|
Middle of the linked list
linked-list
|
O(n) | Dec 5, 2022 | |
|
Minimum score of a path between two cities
graph
|
O(n) | Dec 5, 2022 | |
|
One edit distance
array-and-hashmap
|
O(n) | Dec 5, 2022 | |
|
Remove interval
intervals
|
O(n) | Dec 5, 2022 | |
|
Wiggle sort
array-and-hashmap
|
O(n) | Dec 5, 2022 | |
|
Implement trie II (prefix tree)
trie
design
|
O(n) | Dec 4, 2022 | |
|
Minimum average difference
array-and-hashmap
|
O(n) | Dec 4, 2022 | |
|
Minimum number of steps to make two strings anagram II
array-and-hashmap
|
O(n) | Dec 4, 2022 | |
|
Minimum number of steps to make two strings anagram
array-and-hashmap
|
O(n) | Dec 4, 2022 | |
|
Find k length substrings with no repeated characters
sliding-window
|
O(n) | Dec 3, 2022 | |
|
Longest string chain
dynamic-programming
|
O(n^2) | Dec 3, 2022 | |
|
Longest substring with at most k distinct characters
sliding-window
|
O(n) | Dec 3, 2022 | |
|
Longest substring with at most two distinct characters
sliding-window
|
O(n) | Dec 3, 2022 | |
|
Number of connected components in an undirected graph
graph
|
O(n) | Dec 3, 2022 | |
|
Number of subarrays with gcd equal to k
math-and-geometry
|
O(n^2) | Dec 3, 2022 | |
|
Number of subarrays with lcm equal to k
math-and-geometry
|
O(n^2) | Dec 3, 2022 | |
|
Connecting cities with minimum cost
graph
|
O(nlog(n)) | Dec 2, 2022 | |
|
Determine if two strings are close
array-and-hashmap
|
O(n) | Dec 2, 2022 | |
|
Minimum cost to reach city with discounts
graph
|
O(nlog(n)) | Dec 2, 2022 | |
|
Nth digit
math-and-geometry
|
O(log(n)) | Dec 2, 2022 | |
|
Previous permutation with one swap
greedy
|
O(n) | Dec 2, 2022 | |
|
Search in a sorted array of unknown size
binary-search
|
O(log(n)) | Dec 2, 2022 | |
|
Determine if string halves are alike
array-and-hashmap
|
O(n) | Dec 1, 2022 | |
|
Evaluate the bracket pairs of a string
array-and-hashmap
|
O(n) | Dec 1, 2022 | |
|
Factorial trailing zeroes
math-and-geometry
|
O(log(n)) | Dec 1, 2022 | |
|
Majority element II
array-and-hashmap
|
O(n) | Dec 1, 2022 | |
|
Path sum IV
tree
|
O(n) | Dec 1, 2022 | |
|
Single row keyboard
array-and-hashmap
|
O(n) | Dec 1, 2022 | |
|
Bitwise xor of all pairings
bit-manipulation
|
O(n) | Nov 30, 2022 | |
|
Count nodes equal to average of subtree
tree
|
O(n) | Nov 30, 2022 | |
|
Find all lonely numbers in the array
array-and-hashmap
|
O(n) | Nov 30, 2022 | |
|
Find leaves of binary tree
tree
|
O(n) | Nov 30, 2022 | |
|
Fizz buzz
array-and-hashmap
|
O(n) | Nov 30, 2022 | |
|
Maximum average subtree
tree
|
O(n) | Nov 30, 2022 | |
|
Maximum split of positive even integers
greedy
|
O(n) | Nov 30, 2022 | |
|
Nim game
math-and-geometry
|
O(1) | Nov 30, 2022 | |
|
Partitioning into minimum number of deci binary numbers
greedy
|
O(n) | Nov 30, 2022 | |
|
Recover a tree from preorder traversal
tree
|
O(n) | Nov 30, 2022 | |
|
Remove duplicates from an unsorted linked list
linked-list
|
O(n) | Nov 30, 2022 | |
|
Sparse matrix multiplication
math-and-geometry
|
O(n^3) | Nov 30, 2022 | |
|
Unique number of occurrences
array-and-hashmap
|
O(n) | Nov 30, 2022 | |
|
Unique word abbreviation
array-and-hashmap
design
|
O(n) | Nov 30, 2022 | |
|
Verify preorder sequence in binary search tree
tree
|
— | Nov 30, 2022 | |
|
Count of smaller numbers after self
binary-search
|
O(nlog(n)) | Nov 29, 2022 | |
|
Count univalue subtrees
tree
|
O(n) | Nov 29, 2022 | |
|
Generate a string with characters that have odd counts
array-and-hashmap
|
O(n) | Nov 29, 2022 | |
|
Inorder successor in BST
tree
|
O(h) | Nov 29, 2022 | |
|
Longest subarray of 1s after deleting one element
two-pointers
|
O(n) | Nov 29, 2022 | |
|
Print immutable linked list in reverse
linked-list
stack
|
O(n) | Nov 29, 2022 | |
|
Reverse words in a string II
array-and-hashmap
|
O(n) | Nov 29, 2022 | |
|
Valid palindrome III
dynamic-programming
|
O(n^2) | Nov 29, 2022 | |
|
Binary tree vertical order traversal
tree
|
O(n) | Nov 28, 2022 | |
|
Count nodes equal to sum of descendants
tree
|
O(n) | Nov 28, 2022 | |
|
Count number of bad pairs
dynamic-programming
|
O(n) | Nov 28, 2022 | |
|
Count pairs in two arrays
binary-search
|
O(nlogn) | Nov 28, 2022 | |
|
Design hashset
design
array-and-hashmap
|
O(1) | Nov 28, 2022 | |
|
Design phone directory
design
|
O(1) | Nov 28, 2022 | |
|
Find players with zero or one losses
array-and-hashmap
|
O(nlog(n)) | Nov 28, 2022 | |
|
Minimize product sum of two arrays
greedy
|
O(nlog(n)) | Nov 28, 2022 | |
|
Remove zero sum consecutive nodes from linked list
linked-list
|
O(n) | Nov 28, 2022 | |
|
Shortest word distance
array-and-hashmap
|
O(n) | Nov 28, 2022 | |
|
Validate binary tree nodes
tree
|
O(n) | Nov 28, 2022 | |
|
Arithmetic slices II subsequence
dynamic-programming
|
O(n^2) | Nov 27, 2022 | |
|
Arithmetic slices
dynamic-programming
|
O(n) | Nov 27, 2022 | |
|
Binary tree upside down
tree
|
O(n) | Nov 27, 2022 | |
|
Check if word is valid after substitutions
stack
|
O(n) | Nov 26, 2022 | |
|
Design browser history
linked-list
|
O(n) | Nov 26, 2022 | |
|
Find smallest common element in all rows
array-and-hashmap
|
O(n) | Nov 26, 2022 | |
|
Maximum number of coins you can get
greedy
queue
|
O(nlog(n)) | Nov 26, 2022 | |
|
Maximum twin sum of a linked list
linked-list
|
O(n) | Nov 26, 2022 | |
|
Meeting rooms III
intervals
heap
|
— | Nov 26, 2022 | |
|
Minimize maximum pair sum in array
greedy
|
O(nlog(n)) | Nov 26, 2022 | |
|
Next greater node in linked list
linked-list
stack
|
O(n) | Nov 26, 2022 | |
|
Spiral matrix IV
linked-list
|
O(mn) | Nov 26, 2022 | |
|
Strobogrammatic number
array-and-hashmap
|
O(n) | Nov 26, 2022 | |
|
Add two numbers II
linked-list
stack
|
O(n) | Nov 25, 2022 | |
|
Find greatest common divisor of array
math-and-geometry
|
O(nlog(n)) | Nov 25, 2022 | |
|
Sum of subarray minimums
stack
|
O(n) | Nov 25, 2022 | |
|
Swapping nodes in a linked list
linked-list
|
O(n) | Nov 25, 2022 | |
|
Complement of base 10 integer
bit-maniuplation
|
O(1) | Nov 24, 2022 | |
|
Minimum number of arrows to burst balloons
greedy
|
O(nlog(n)) | Nov 24, 2022 | |
|
Stone game VII
dynamic-programming
|
O(n^2) | Nov 24, 2022 | |
|
The employee that worked on the longest task
array-and-hashmap
|
O(n) | Nov 24, 2022 | |
|
Broken calculator
greedy
|
O(log(n)) | Nov 23, 2022 | |
|
Delete duplicate folders in system
trie
|
O(nlog(n)) | Nov 23, 2022 | |
|
Final prices with a special discount in a shop
stack
|
O(n) | Nov 23, 2022 | |
|
Integer to english words
array-and-hashmap
greedy
|
O(log(n)) | Nov 23, 2022 | |
|
Power of two
math-and-geometry
bit-maniuplation
|
O(log(n)) | Nov 23, 2022 | |
|
Rabbits in forest
math-and-geometry
|
O(n) | Nov 23, 2022 | |
|
Sliding window median
sliding-window
|
O(nlog(n)) | Nov 23, 2022 | |
|
odd-even-jump
dynamic-programming
stack
|
O(nlog(n)) | Nov 22, 2022 | |
|
132 pattern
stack
|
O(n) | Nov 22, 2022 | |
|
Boats to save people
two-pointers
|
O(nlog(n)) | Nov 22, 2022 | |
|
Number of ways to paint N×3 grid
dynamic-programming
|
O(n) | Nov 22, 2022 | |
|
Process tasks using servers
heap
|
O(nlog(n)) | Nov 22, 2022 | |
|
Random pick index
array-and-hashmap
design
|
O(1) | Nov 22, 2022 | |
|
Shuffle an array
math-and-geometry
design
|
O(n) | Nov 22, 2022 | |
|
Sort colors
two-pointers
array-and-hashmap
|
O(n) | Nov 22, 2022 | |
|
Split array largest sum
binary-search
|
— | Nov 22, 2022 | |
|
Base 7
math-and-geometry
|
O(log(n)) | Nov 21, 2022 | |
|
Camelcase matching
two-pointers
queue
|
O(n) | Nov 21, 2022 | |
|
design linked list
linked-list
design
|
— | Nov 21, 2022 | |
|
Linked list in binary tree
linked-list
tree
|
O(n) | Nov 21, 2022 | |
|
Maximum sum circular subarray
array-and-hashmap
|
O(n) | Nov 21, 2022 | |
|
Minimum addition to make integer beautiful
math-and-geometry
|
O(log(n)) | Nov 21, 2022 | |
|
Nearest exit from entrance in maze
graph
|
O(mn) | Nov 21, 2022 | |
|
Number of operations to make network connected
graph
|
O(n) | Nov 21, 2022 | |
|
Sum of absolute differences in a sorted array
array-and-hashmap
|
O(n) | Nov 21, 2022 | |
|
Total cost to hire k workers
heap
|
O(nlog(n)) | Nov 21, 2022 | |
|
Vowel spellchecker
array-and-hashmap
|
O(n) | Nov 21, 2022 | |
|
All nodes distance k in binary tree
tree
|
O(n) | Nov 20, 2022 | |
|
Find all duplicates in an array
array-and-hashmap
|
O(n) | Nov 20, 2022 | |
|
Maximum length of pair chain
greedy
|
O(nlog(n)) | Nov 20, 2022 | |
|
Number of orders in the backlog
heap
|
O(nlog(n)) | Nov 20, 2022 | |
|
Number of ways to arrive at destination
graph
|
O(nlog(n)) | Nov 20, 2022 | |
|
Path with maximum probability
graph
|
O(nlog(n)) | Nov 20, 2022 | |
|
Reverse prefix of word
array-and-hashmap
|
O(n) | Nov 20, 2022 | |
|
Shopping offers
dynamic-programming
|
O(n^m) | Nov 20, 2022 | |
|
Widest vertical area between two points containing no points
array-and-hashmap
|
O(nlogn) | Nov 20, 2022 | |
|
Binary subarrays with sum
array-and-hashmap
sliding-window
|
O(n) | Nov 19, 2022 | |
|
Erect the fence
math-and-geometry
|
O(nlogn) | Nov 19, 2022 | |
|
Maximum product after k increments
heap
|
O(klog(n)) | Nov 19, 2022 | |
|
Number of ways to split array
array-and-hashmap
|
O(n) | Nov 19, 2022 | |
|
First letter to appear twice
array-and-hashmap
|
O(n) | Nov 18, 2022 | |
|
Frog position after t seconds
graph
|
O(n) | Nov 18, 2022 | |
|
Linked list components
linked-list
|
O(n) | Nov 18, 2022 | |
|
Find the highest altitude
array-and-hashmap
|
O(n) | Nov 17, 2022 | |
|
Finding the users active minutes
array-and-hashmap
|
O(n) | Nov 17, 2022 | |
|
Number of digit one
math-and-geometry
|
O(log(n)) | Nov 17, 2022 | |
|
Rectangle area
math-and-geometry
|
O(1) | Nov 17, 2022 | |
|
Symmetric tree
tree
|
O(n) | Nov 17, 2022 | |
|
Construct binary search tree from preorder traversal
tree
|
O(n) | Nov 16, 2022 | |
|
Count days spent together
array-and-hashmap
|
O(1) | Nov 16, 2022 | |
|
Delete nodes and return forest
tree
|
O(n) | Nov 16, 2022 | |
|
Insert into a binary search tree
tree
|
O(n) | Nov 16, 2022 | |
|
Making file names unique
array-and-hashmap
|
O(n) | Nov 16, 2022 | |
|
Minimum distance to the target element
array-and-hashmap
|
O(n) | Nov 16, 2022 | |
|
Minimum time visiting all points
greedy
|
O(n) | Nov 16, 2022 | |
|
Path in zigzag labelled binary tree
tree
|
O(log(n)) | Nov 16, 2022 | |
|
Shortest subarray to be removed to make array sorted
two-pointers
|
O(n) | Nov 16, 2022 | |
|
Trim a binary search tree
tree
|
O(n) | Nov 16, 2022 | |
|
Binary tree tilt
tree
|
O(n) | Nov 15, 2022 | |
|
Count of matches in tournament
math-and-geometry
|
O(log(n)) | Nov 15, 2022 | |
|
Dungeon game
dynamic-programming
|
O(mn) | Nov 15, 2022 | |
|
Find duplicate subtrees
tree
|
O(n) | Nov 15, 2022 | |
|
Find mode in binary search tree
tree
|
O(n) | Nov 15, 2022 | |
|
Longest substring of all vowels in order
sliding-window
|
O(n) | Nov 15, 2022 | |
|
Make two arrays equal by reversing subarrays
array-and-hashmap
|
O(nlog(n)) | Nov 15, 2022 | |
|
Maximum area of a piece of cake after horizontal and vertical cuts
greedy
|
O(nlogn+mlogm) | Nov 15, 2022 | |
|
Maximum width of binary tree
tree
|
O(n) | Nov 15, 2022 | |
|
Maximum xor after operations
bit-manipulation
|
O(n) | Nov 15, 2022 | |
|
Most frequent subtree sum
tree
|
O(n) | Nov 15, 2022 | |
|
Path sum III
dynamic-programming
backtracking
tree
|
O(n) | Nov 15, 2022 | |
|
Merge strings alternately
array-and-hashmap
|
O(n+m) | Nov 14, 2022 | |
|
Most stones removed with same row or column
graph
|
O(n) | Nov 14, 2022 | |
|
Maximum frequency stack
stack
design
|
— | Nov 13, 2022 | |
|
Number of subarrays with bounded maximum
two-pointers
|
O(n) | Nov 13, 2022 | |
|
Leaf similar trees
tree
|
O(n+m) | Nov 12, 2022 | |
|
Least number of unique integers after k removals
heap
|
O(n+klog(n)) | Nov 12, 2022 | |
|
Number of zero filled subarrays
math-and-geometry
|
O(n) | Nov 12, 2022 | |
|
Count numbers with unique digits
math-and-geometry
|
O(n) | Nov 11, 2022 | |
|
Removing minimum number of magic beans
array-and-hashmap
|
O(nlog(n)) | Nov 11, 2022 | |
|
Find peak element
binary-search
|
O(log(n)) | Nov 10, 2022 | |
|
Maximum nesting depth of the parentheses
stack
|
O(n) | Nov 10, 2022 | |
|
Remove all adjacent duplicates in string II
stack
|
O(n) | Nov 10, 2022 | |
|
Remove all adjacent duplicates in string
stack
|
O(n) | Nov 10, 2022 | |
|
Score of parentheses
stack
|
O(n) | Nov 10, 2022 | |
|
Triangle
dynamic-programming
|
O(n^2) | Nov 10, 2022 | |
|
Distribute candies
array-and-hashmap
|
O(n) | Nov 9, 2022 | |
|
Online stock span
stack
|
O(n) | Nov 9, 2022 | |
|
Average value of even numbers that are divisible by three
math-and-geometry
|
O(n) | Nov 8, 2022 | |
|
Knight dialer
dynamic-programming
|
O(n) | Nov 8, 2022 | |
|
Make the string great
stack
|
O(n) | Nov 8, 2022 | |
|
Minimum money required before transactions
greedy
|
O(n) | Nov 8, 2022 | |
|
Pascals triangle II
array-and-hashmap
|
O(n) | Nov 8, 2022 | |
|
Array with elements not equal to average of neighbors
two-pointers
|
O(nlogn) | Nov 7, 2022 | |
|
Maximum 69 number
array-and-hashmap
|
O(n) | Nov 7, 2022 | |
|
Number of subsequences that satisfy the given sum condition
two-pointers
|
O(nlogn) | Nov 7, 2022 | |
|
Wiggle sort II
array-and-hashmap
|
O(nlogn) | Nov 7, 2022 | |
|
Check completeness of a binary tree
tree
|
O(n) | Nov 6, 2022 | |
|
Design an ordered stream
design
|
O(n) | Nov 6, 2022 | |
|
Jewels and stones
array-and-hashmap
|
O(n) | Nov 6, 2022 | |
|
Minimum number of vertices to reach all nodes
graph
|
O(n) | Nov 6, 2022 | |
|
Orderly queue
array-and-hashmap
|
O(n^n) | Nov 6, 2022 | |
|
Sort integers by the number of 1 bits
bit-manipulation
|
O(nlogn) | Nov 6, 2022 | |
|
Counting words with a given prefix
array-and-hashmap
|
O(n) | Nov 5, 2022 | |
|
Find all numbers disappeared in an array
array-and-hashmap
|
O(n) | Nov 5, 2022 | |
|
Find pivot index
array-and-hashmap
|
O(n) | Nov 5, 2022 | |
|
Majority element
array-and-hashmap
|
O(n) | Nov 5, 2022 | |
|
Maximum number of balloons
array-and-hashmap
|
O(n) | Nov 5, 2022 | |
|
Merge in between linked lists
linked-list
|
O(n) | Nov 5, 2022 | |
|
Next greater element II
stack
|
O(n) | Nov 5, 2022 | |
|
Sum of beauty of all substrings
array-and-hashmap
|
O(n^2) | Nov 5, 2022 | |
|
The k strongest values in an array
array-and-hashmap
|
O(nlogn) | Nov 5, 2022 | |
|
Word pattern
array-and-hashmap
|
O(n) | Nov 5, 2022 | |
|
Encode and decode tinyurl
design
|
O(1) | Nov 4, 2022 | |
|
Maximum profit in job scheduling
dynamic-programming
intervals
|
O(n^2) | Nov 4, 2022 | |
|
Maximum score from removing stones
greedy
|
O(n) | Nov 4, 2022 | |
|
Partition array into three parts with equal sum
greedy
|
O(n) | Nov 4, 2022 | |
|
Reverse vowels of a string
stack
|
O(n) | Nov 4, 2022 | |
|
Longest palindrome by concatenating two letter words
array-and-hashmap
|
O(n) | Nov 3, 2022 | |
|
Smallest good base
math-and-geometry
|
O(log(n)^2) | Nov 3, 2022 | |
|
Count items matching a rule
array-and-hashmap
|
O(n) | Nov 2, 2022 | |
|
Intersection of two arrays
intervals
|
O(n) | Nov 2, 2022 | |
|
Largest 3 same digit number in string
array-and-hashmap
|
O(n) | Nov 2, 2022 | |
|
Letter tile possibilities
backtracking
|
O(n!) | Nov 1, 2022 | |
|
Minimum absolute difference in bst
tree
|
O(n) | Nov 1, 2022 | |
|
Minimum swaps to group all 1s together II
sliding-window
|
O(n) | Nov 1, 2022 | |
|
Where will the ball fall
array-and-hashmap
|
O(r*c) | Nov 1, 2022 | |
|
Find all possible recipes from given supplies
graph
|
O(n) | Oct 31, 2022 | |
|
Optimal division
math-and-geometry
|
O(n) | Oct 31, 2022 | |
|
Pairs of songs with total durations divisible by 60
math-and-geometry
|
O(n) | Oct 31, 2022 | |
|
Toeplitz matrix
array-and-hashmap
|
O(n) | Oct 31, 2022 | |
|
Divide array into equal pairs
array-and-hashmap
|
O(n) | Oct 30, 2022 | |
|
Shortest path in a grid with obstacles elimination
graph
|
O(mn) | Oct 30, 2022 | |
|
Valid number
array-and-hashmap
|
O(n) | Oct 30, 2022 | |
|
Earliest possible day of full bloom
greedy
|
O(nlogn) | Oct 29, 2022 | |
|
Most frequent number following key in an array
array-and-hashmap
|
O(n) | Oct 29, 2022 | |
|
Search in a binary search tree
tree
|
O(n) | Oct 29, 2022 | |
|
All elements in two binary search trees
tree
|
O(n1+n2) | Oct 28, 2022 | |
|
Fruit into baskets
sliding-window
|
O(n) | Oct 28, 2022 | |
|
Integer replacement
dynamic-programming
|
O(n) | Oct 28, 2022 | |
|
Max consecutive ones III
sliding-window
|
O(n) | Oct 28, 2022 | |
|
Max consecutive ones
sliding-window
|
O(n) | Oct 28, 2022 | |
|
Replace the substring for balanced string
sliding-window
|
O(n) | Oct 28, 2022 | |
|
Sum of number and its reverse
math-and-geometry
|
O(n) | Oct 28, 2022 | |
|
Count good numbers
math-and-geometry
|
O(1) | Oct 27, 2022 | |
|
Image overlap
array-and-hashmap
|
O(n^2) | Oct 27, 2022 | |
|
Predict the winner
dynamic-programming
|
O(n) | Oct 27, 2022 | |
|
XOR queries of a subarray
bit-manipulation
|
O(n) | Oct 27, 2022 | |
|
Groups of special equivalent strings
array-and-hashmap
|
O(n*klog(k)) | Oct 26, 2022 | |
|
Kth missing positive number
binary-search
|
O(n) | Oct 26, 2022 | |
|
Longest uploaded prefix
heap
design
|
O(n) | Oct 26, 2022 | |
|
Maximum number of pairs in array
array-and-hashmap
|
O(n) | Oct 26, 2022 | |
|
Minesweeper
graph
|
O(n^2) | Oct 26, 2022 | |
|
Shortest bridge
graph
|
O(n^2) | Oct 26, 2022 | |
|
Check if two string arrays are equivalent
array-and-hashmap
|
O(n) | Oct 25, 2022 | |
|
Escape the ghosts
math-and-geometry
|
O(n) | Oct 25, 2022 | |
|
Reverse odd levels of binary tree
tree
|
O(n) | Oct 25, 2022 | |
|
Serialize and deserialize bst
tree
design
|
O(n) | Oct 25, 2022 | |
|
Maximum length of a concatenated string with unique characters
array-and-hashmap
|
O(n^2) | Oct 24, 2022 | |
|
Open the lock
graph
|
O(n^2) | Oct 24, 2022 | |
|
Can place flowers
greedy
|
O(n) | Oct 23, 2022 | |
|
Integer break
dynamic-programming
|
O(n^2) | Oct 23, 2022 | |
|
Set mismatch
math-and-geometry
|
O(n) | Oct 23, 2022 | |
|
Destination city
array-and-hashmap
|
O(n) | Oct 22, 2022 | |
|
Minimum number of operations to convert time
greedy
|
O(1) | Oct 22, 2022 | |
|
Contains duplicate II
array-and-hashmap
|
O(n) | Oct 21, 2022 | |
|
Isomorphic strings
array-and-hashmap
|
O(n) | Oct 21, 2022 | |
|
Unique email addresses
array-and-hashmap
|
O(n) | Oct 21, 2022 | |
|
Maximum points you can obtain from cards
greedy
|
O(n) | Oct 20, 2022 | |
|
Number of valid move combinations on chessboard
backtracking
|
O(n^2) | Oct 20, 2022 | |
|
Map sum pairs
trie
|
O(n) | Oct 19, 2022 | |
|
Minimum operations to halve array sum
heap
|
O(nlog(n)) | Oct 19, 2022 | |
|
Queries on a permutation with key
array-and-hashmap
|
O(n^2) | Oct 19, 2022 | |
|
Short encoding of words
trie
|
O(n) | Oct 19, 2022 | |
|
Reduction operations to make the array elements equal
greedy
|
O(nlog(n)) | Oct 18, 2022 | |
|
Best sightseeing pair
array-and-hashmap
|
O(n) | Oct 17, 2022 | |
|
Convert binary number in a linked list to integer
linked-list
|
O(n) | Oct 16, 2022 | |
|
Delete leaves with a given value
tree
|
O(n) | Oct 16, 2022 | |
|
Find numbers with even number of digits
array-and-hashmap
|
O(n^2) | Oct 16, 2022 | |
|
Minimum difficulty of a job schedule
dynamic-programming
|
O(n^2*d) | Oct 16, 2022 | |
|
String compression II
dynamic-programming
|
O(n*k) | Oct 15, 2022 | |
|
Delete the middle node of a linked list
linked-list
|
O(n) | Oct 14, 2022 | |
|
Find missing observations
math-and-geometry
|
O(m+n) | Oct 13, 2022 | |
|
Find positive integer solution for a given equation
math-and-geometry
|
O(x+y) | Oct 13, 2022 | |
|
Shift 2d grid
math-and-geometry
|
O(m*n) | Oct 13, 2022 | |
|
Determine whether matrix can be obtained by rotation
array-and-hashmap
|
O(n^2) | Oct 12, 2022 | |
|
Largest perimeter triangle
math-and-geometry
|
O(nlogn) | Oct 12, 2022 | |
|
Increasing triplet subsequence
greedy
|
O(n) | Oct 11, 2022 | |
|
Number of recent calls
queue
design
|
O(n) | Oct 11, 2022 | |
|
Break a palindrome
array-and-hashmap
|
O(n) | Oct 10, 2022 | |
|
Convert bst to greater tree
tree
|
O(n) | Oct 9, 2022 | |
|
Find bottom left tree value
tree
|
O(n) | Oct 9, 2022 | |
|
Flip equivalent binary trees
tree
|
O(n) | Oct 9, 2022 | |
|
Frequency of the most frequent element
sliding-window
|
O(nlogn) | Oct 9, 2022 | |
|
Guess number higher or lower
binary-search
|
O(log(n)) | Oct 9, 2022 | |
|
Two sum IV input is a bst
tree
|
O(n) | Oct 9, 2022 | |
|
Find all anagrams in a string
array-and-hashmap
|
O(n*m) | Oct 8, 2022 | |
|
Find the index of the first occurrence in a string
sliding-window
|
O(n) | Oct 8, 2022 | |
|
Remove element
array-and-hashmap
|
O(n) | Oct 8, 2022 | |
|
Unique length 3 palindromic subsequences
array-and-hashmap
|
O(n) | Oct 8, 2022 | |
|
Reverse linked list II
linked-list
|
O(n) | Oct 7, 2022 | |
|
Search insert position
binary-search
|
O(log(n)) | Oct 7, 2022 | |
|
Single threaded cpu
heap
|
O(nlog(n)) | Oct 7, 2022 | |
|
Baseball game
stack
|
O(n) | Oct 6, 2022 | |
|
Is subsequence
two-pointers
|
O(n) | Oct 6, 2022 | |
|
Length of last word
two-pointers
|
O(n) | Oct 6, 2022 | |
|
Longest common prefix
array-and-hashmap
|
O(n^m) | Oct 6, 2022 | |
|
Merge two binary trees
tree
|
O(n) | Oct 6, 2022 | |
|
Replace elements with greatest element on right side
array-and-hashmap
|
O(n) | Oct 6, 2022 | |
|
Add one row to tree
tree
|
O(n) | Oct 5, 2022 | |
|
Add binary
bit-manipulation
|
O(max(n, m)) | Oct 4, 2022 | |
|
Delete node in a linked list
linked-list
|
O(1) | Oct 4, 2022 | |
|
N-queens II
backtracking
|
O(n^2) | Oct 4, 2022 | |
|
Palindrome number
math-and-geometry
|
O(n) | Oct 4, 2022 | |
|
Remove covered intervals
intervals
|
O(nlog(n)) | Oct 4, 2022 | |
|
Ugly number
math-and-geometry
|
O(n) | Oct 4, 2022 | |
|
Asteroid collision
stack
|
O(n) | Oct 3, 2022 | |
|
Minimum time to make rope colorful
greedy
|
O(n) | Oct 3, 2022 | |
|
Minimum difference between highest and lowest of k scores
sliding-window
|
O(nlog(n)) | Oct 2, 2022 | |
|
Move zeroes
two-pointers
|
O(n) | Oct 2, 2022 | |
|
Number of dice rolls with target sum
dynamic-programming
|
O(n*k*t) | Oct 2, 2022 | |
|
Rotate array
two-pointers
|
O(n) | Oct 2, 2022 | |
|
Intersection of two linked lists
linked-list
|
O(n) | Oct 1, 2022 | |
|
Merge sorted array
two-pointers
|
O(n) | Oct 1, 2022 | |
|
Reverse string
two-pointers
|
O(n) | Oct 1, 2022 | |
|
Valid palindrome II
two-pointers
|
O(n) | Oct 1, 2022 | |
|
Destroying asteroids
greedy
|
O(nlog(n)) | Sep 30, 2022 | |
|
Dota2 senate
greedy
queue
|
O(n) | Sep 30, 2022 | |
|
Reveal cards in increasing order
queue
|
O(nlog(n)) | Sep 30, 2022 | |
|
Word break II
trie
backtracking
|
O(n^2) | Sep 30, 2022 | |
|
Design front middle back queue
queue
design
|
O(1) | Sep 29, 2022 | |
|
Find the winner of the circular game
queue
|
O(n*k) | Sep 29, 2022 | |
|
Flood fill
graph
|
O(n) | Sep 28, 2022 | |
|
Product of the last k numbers
queue
design
|
O(1) | Sep 28, 2022 | |
|
Bulb switcher
math-and-geometry
|
O(1) | Sep 27, 2022 | |
|
Design circular deque
queue
design
|
O(1) | Sep 27, 2022 | |
|
Flatten nested list iterator
queue
design
|
O(n) | Sep 27, 2022 | |
|
Push dominoes
two-pointers
|
O(n^2) | Sep 27, 2022 | |
|
Reverse string II
two-pointers
|
O(n) | Sep 27, 2022 | |
|
Strictly palindromic number
math-and-geometry
|
O(n^2) | Sep 27, 2022 | |
|
Satisfiability of equality equations
graph
|
O(n^2) | Sep 26, 2022 | |
|
Count nice pairs in an array
array-and-hashmap
|
O(n) | Sep 25, 2022 | |
|
Concatenation of consecutive binary numbers
bit-manipulation
|
O(n) | Sep 23, 2022 | |
|
Partition to k equal sum subsets
backtracking
|
O(k * 2^n) | Sep 23, 2022 | |
|
Reverse words in a string III
array-and-hashmap
|
O(n) | Sep 22, 2022 | |
|
Sum of even numbers after queries
array-and-hashmap
|
O(n) | Sep 21, 2022 | |
|
Find duplicate file in system
array-and-hashmap
|
O(n) | Sep 19, 2022 | |
|
Number of sub arrays with odd sum
math-and-geometry
|
O(n) | Sep 18, 2022 | |
|
Deepest leaves sum
tree
|
O(n) | Sep 17, 2022 | |
|
Iterator for combination
design
backtracking
|
O(nCk) | Sep 17, 2022 | |
|
Design an atm machine
greedy
design
|
O(1) | Sep 16, 2022 | |
|
Finding pairs with a certain sum
design
|
O(n+m) | Sep 16, 2022 | |
|
Maximum score from performing multiplication operations
dynamic-programming
|
O(n*m) | Sep 16, 2022 | |
|
Minimum genetic mutation
graph
|
O(n) | Sep 16, 2022 | |
|
Minimum insertions to balance a parentheses string
stack
greedy
|
O(n) | Sep 16, 2022 | |
|
Stone game
dynamic-programming
|
O(n^2) | Sep 16, 2022 | |
|
Find original array from doubled array
array-and-hashmap
|
O(nlog(n)) | Sep 15, 2022 | |
|
Validate ip address
array-and-hashmap
|
O(1) | Sep 15, 2022 | |
|
Insufficient nodes in root to leaf paths
tree
|
O(n) | Sep 14, 2022 | |
|
Pseudo palindromic paths in a binary tree
backtracking
tree
|
O(n) | Sep 14, 2022 | |
|
Spiral matrix II
math-and-geometry
|
O(n) | Sep 14, 2022 | |
|
Is graph bipartite
graph
|
O(n) | Sep 13, 2022 | |
|
Range sum query immutable
design
|
O(n) | Sep 13, 2022 | |
|
Reorder data in log files
array-and-hashmap
|
O(nlog(n)) | Sep 13, 2022 | |
|
UTF-8 validation
bit-manipulation
|
O(n) | Sep 13, 2022 | |
|
Bag of tokens
two-pointers
|
O(nlog(n)) | Sep 12, 2022 | |
|
Different ways to add parentheses
dynamic-programming
|
O(n) | Sep 12, 2022 | |
|
Elimination game
math-and-geometry
|
O(n) | Sep 12, 2022 | |
|
Longest word in dictionary
trie
|
O(n) | Sep 12, 2022 | |
|
Sender with largest word count
array-and-hashmap
|
O(nlog(n)) | Sep 12, 2022 | |
|
Find the city with the smallest number of neighbors at a threshold distance
graph
|
O(n^3) | Sep 11, 2022 | |
|
Max sum of a pair with equal sum of digits
array-and-hashmap
|
O(n) | Sep 11, 2022 | |
|
Maximum difference between node and ancestor
tree
|
O(n) | Sep 11, 2022 | |
|
Maximum performance of a team
heap
|
O(nlog(n)) | Sep 11, 2022 | |
|
Minimum falling path sum
dynamic-programming
|
O(n*m) | Sep 11, 2022 | |
|
Number of restricted paths from first to last node
graph
|
O(elog(v)) | Sep 11, 2022 | |
|
Best time to buy and sell stock II
dynamic-programming
|
O(n) | Sep 10, 2022 | |
|
Best time to buy and sell stock III
dynamic-programming
|
O(n) | Sep 10, 2022 | |
|
Best time to buy and sell stock IV
dynamic-programming
|
O(n) | Sep 10, 2022 | |
|
Coloring a border
graph
|
O(n) | Sep 10, 2022 | |
|
Count and say
array-and-hashmap
|
O(n) | Sep 10, 2022 | |
|
Island perimeter
graph
|
O(n) | Sep 10, 2022 | |
|
Maximum binary tree II
tree
|
O(n) | Sep 10, 2022 | |
|
Maximum binary tree
tree
|
O(n) | Sep 10, 2022 | |
|
Partition array according to given pivot
array-and-hashmap
|
O(n) | Sep 10, 2022 | |
|
Wildcard matching
dynamic-programming
|
O(n*m) | Sep 10, 2022 | |
|
Design a food rating system
heap
design
|
O(nlog(n)) | Sep 9, 2022 | |
|
Minimum number of swaps to make the string balanced
stack
|
O(n) | Sep 9, 2022 | |
|
Peeking iterator
design
|
O(1) | Sep 9, 2022 | |
|
Remove linked list elements
linked-list
|
O(n) | Sep 9, 2022 | |
|
The number of weak characters in the game
heap
|
O(nlog(n)) | Sep 9, 2022 | |
|
Tuple with same product
array-and-hashmap
|
O(n^2) | Sep 9, 2022 | |
|
Build an array with stack operations
two-pointers
|
O(n) | Sep 8, 2022 | |
|
Combination sum III
backtracking
|
O(2^n) | Sep 8, 2022 | |
|
Find k closest elements
heap
|
O(nlog(k)) | Sep 8, 2022 | |
|
Maximum erasure value
sliding-window
|
O(n) | Sep 8, 2022 | |
|
Minimum consecutive cards to pick up
sliding-window
|
O(n) | Sep 8, 2022 | |
|
Repeated dna sequences
sliding-window
|
O(n) | Sep 8, 2022 | |
|
Robot bounded in circle
math-and-geometry
|
O(n) | Sep 8, 2022 | |
|
Construct string from binary tree
tree
|
O(n) | Sep 7, 2022 | |
|
Keys and rooms
graph
|
O(n) | Sep 7, 2022 | |
|
Print binary tree
tree
|
O(n) | Sep 7, 2022 | |
|
Binary tree pruning
tree
|
O(n) | Sep 6, 2022 | |
|
Design a stack with increment operation
design
stack
|
O(1) | Sep 6, 2022 | |
|
H-index II
array-and-hashmap
|
O(log(n)) | Sep 6, 2022 | |
|
H-index
array-and-hashmap
|
O(n) | Sep 6, 2022 | |
|
Implement magic dictionary
trie
design
|
O(n^2) | Sep 6, 2022 | |
|
Lexicographical numbers
graph
|
O(nlog(n)) | Sep 6, 2022 | |
|
Linked list random node
linked-list
|
O(n) | Sep 6, 2022 | |
|
Merge nodes in between zeros
linked-list
|
O(n) | Sep 6, 2022 | |
|
Query kth smallest trimmed number
heap
|
O(q*nlog(n)) | Sep 6, 2022 | |
|
Remove stones to minimize the total
heap
|
— | Sep 6, 2022 | |
|
Replace words
trie
|
O(n*k) | Sep 6, 2022 | |
|
Reverse words in a string
array-and-hashmap
|
O(n) | Sep 6, 2022 | |
|
Seat reservation manager
heap
|
O(n) | Sep 6, 2022 | |
|
Smallest number in infinite set
heap
|
O(nlog(n)) | Sep 6, 2022 | |
|
Sort an array
array-and-hashmap
|
O(nlog(n)) | Sep 6, 2022 | |
|
Sort characters by frequency
array-and-hashmap
|
O(nlog(n)) | Sep 6, 2022 | |
|
All ancestors of a node in a directed acyclic graph
graph
|
O(n^2) | Sep 5, 2022 | |
|
Basic calculator II
stack
|
O(n) | Sep 5, 2022 | |
|
Basic calculator III
stack
|
O(n) | Sep 5, 2022 | |
|
Basic calculator
stack
|
O(n) | Sep 5, 2022 | |
|
Battleships in a board
graph
|
O(n) | Sep 5, 2022 | |
|
Count primes
math-and-geometry
|
— | Sep 5, 2022 | |
|
Course schedule IV
graph
|
O(q*(n+p)) | Sep 5, 2022 | |
|
House robber III
graph
|
O(n) | Sep 5, 2022 | |
|
Linked list cycle II
linked-list
|
O(n) | Sep 5, 2022 | |
|
Longest absolute file path
stack
|
O(n) | Sep 5, 2022 | |
|
Number of enclaves
graph
|
O((m*n)^2) | Sep 5, 2022 | |
|
Path sum II
backtracking
|
O(n) | Sep 5, 2022 | |
|
Remove duplicate letters
stack
|
O(n) | Sep 5, 2022 | |
|
Restore ip addresses
backtracking
|
O(n^2) | Sep 5, 2022 | |
|
Search in rotated sorted array II
binary-search
|
O(log(n)) | Sep 5, 2022 | |
|
Single number II
bit-manipulation
|
O(n) | Sep 5, 2022 | |
|
Single number III
bit-manipulation
|
O(n) | Sep 5, 2022 | |
|
Sort list
linked-list
|
O(nlog(n)) | Sep 5, 2022 | |
|
Amount of time for binary tree to be infected
tree
|
O(n) | Sep 4, 2022 | |
|
Binary search tree iterator
tree
|
O(n) | Sep 4, 2022 | |
|
Binary tree level order traversal II
tree
|
O(n) | Sep 4, 2022 | |
|
Binary tree zigzag level order traversal
tree
|
O(n) | Sep 4, 2022 | |
|
Construct binary tree from inorder and postorder traversal
tree
|
O(n) | Sep 4, 2022 | |
|
Convert sorted list to binary search tree
tree
|
O(n) | Sep 4, 2022 | |
|
Count complete tree nodes
tree
|
O(log(n)) | Sep 4, 2022 | |
|
delete-node-in-a-bst
tree
|
O(log(n)) | Sep 4, 2022 | |
|
Evaluate division
graph
|
O(n^2*q) | Sep 4, 2022 | |
|
Populating next right pointers in each node II
tree
|
O(n) | Sep 4, 2022 | |
|
Populating next right pointers in each node
tree
|
O(n) | Sep 4, 2022 | |
|
Recover binary search tree
tree
|
O(nlog(n)) | Sep 4, 2022 | |
|
Unique binary search trees II
dynamic-programming
|
O(n^2) | Sep 4, 2022 | |
|
Unique binary search trees
dynamic-programming
|
O(n^2) | Sep 4, 2022 | |
|
Verify preorder serialization of a binary tree
stack
|
O(n) | Sep 4, 2022 | |
|
Vertical order traversal of a binary tree
tree
|
O(n) | Sep 4, 2022 | |
|
Balance a binary search tree
tree
|
O(n) | Sep 3, 2022 | |
|
Decode string
stack
|
O(n) | Sep 3, 2022 | |
|
Design underground system
design
|
O(1) | Sep 3, 2022 | |
|
Equal row and column pairs
array-and-hashmap
|
O(n*m) | Sep 3, 2022 | |
|
Gray code
bit-manipulation
|
O(2^n) | Sep 3, 2022 | |
|
Largest number
array-and-hashmap
|
O(nlog(n)) | Sep 3, 2022 | |
|
Minimum moves to equal array elements II
math-and-geometry
|
O(nlog(n)) | Sep 3, 2022 | |
|
Numbers with same consecutive differences
backtracking
|
O(n) | Sep 3, 2022 | |
|
Sell diminishing valued colored balls
heap
|
O(nlog(n)) | Sep 3, 2022 | |
|
Average of levels in binary tree
tree
|
O(n) | Sep 2, 2022 | |
|
Minimum time difference
intervals
|
O(nlog(n)) | Sep 2, 2022 | |
|
Reachable nodes with restrictions
graph
|
O(ev) | Sep 2, 2022 | |
|
Sudoku solver
backtracking
|
O(n^2) | Sep 2, 2022 | |
|
Sum root to leaf numbers
tree
|
O(n) | Sep 2, 2022 | |
|
4sum
array-and-hashmap
|
O(n^3) | Sep 1, 2022 | |
|
Bitwise and of numbers range
bit-manipulation
|
O(n) | Sep 1, 2022 | |
|
Clumsy factorial
math-and-geometry
|
O(1) | Sep 1, 2022 | |
|
Insertion sort list
linked-list
|
O(n^2) | Sep 1, 2022 | |
|
Integer to roman
array-and-hashmap
|
O(n) | Sep 1, 2022 | |
|
Minimum height trees
graph
|
O(n) | Sep 1, 2022 | |
|
Minimum moves to equal array elements
math-and-geometry
|
O(n) | Sep 1, 2022 | |
|
N-ary tree level order traversal
tree
|
O(n) | Sep 1, 2022 | |
|
Next permutation
array-and-hashmap
|
O(n) | Sep 1, 2022 | |
|
Simple bank system
array-and-hashmap
|
O(1) | Sep 1, 2022 | |
|
Zigzag conversion
array-and-hashmap
|
O(n) | Sep 1, 2022 | |
|
Continuous subarray sum
array-and-hashmap
|
O(n) | Aug 31, 2022 | |
|
Rearrange words in a sentence
array-and-hashmap
|
O(nlog(n)) | Aug 31, 2022 | |
|
Subarray sum equals k
array-and-hashmap
|
O(n) | Aug 31, 2022 | |
|
Furthest building you can reach
heap
|
O(nlog(l)) | Aug 30, 2022 | |
|
Get equal substrings within budget
sliding-window
|
O(n) | Aug 30, 2022 | |
|
Maximum xor of two numbers in an array
bit-manipulation
|
O(n) | Aug 30, 2022 | |
|
Minimum moves to make array complementary
array-and-hashmap
|
O(n+l) | Aug 30, 2022 | |
|
Remove duplicates from sorted list II
linked-list
|
O(n) | Aug 30, 2022 | |
|
Remove duplicates from sorted list
linked-list
|
O(n) | Aug 30, 2022 | |
|
All paths from source to target
backtracking
|
O(2^n) | Aug 29, 2022 | |
|
Divide two integers
math-and-geometry
|
O(1) | Aug 29, 2022 | |
|
Minimum size subarray sum
sliding-window
|
O(n) | Aug 29, 2022 | |
|
Number of islands
graph
|
O(n^2) | Aug 29, 2022 | |
|
Number of provinces
graph
|
O(n^2) | Aug 29, 2022 | |
|
Remove duplicates from sorted array II
array-and-hashmap
|
O(nlog(n)) | Aug 29, 2022 | |
|
Remove duplicates from sorted array
array-and-hashmap
|
O(nlog(n)) | Aug 29, 2022 | |
|
Simplify path
stack
|
O(n) | Aug 29, 2022 | |
|
Combinations
backtracking
|
O(nCk) | Aug 28, 2022 | |
|
First missing positive
array-and-hashmap
|
O(n) | Aug 28, 2022 | |
|
Game of life
array-and-hashmap
|
O(n*m) | Aug 28, 2022 | |
|
Sort the matrix diagonally
math-and-geometry
|
O(n*m*log(n*m)) | Aug 28, 2022 | |
|
Unique paths II
dynamic-programming
|
O(n*m) | Aug 28, 2022 | |
|
Validate stack sequences
stack
|
O(n) | Aug 28, 2022 | |
|
3sum closest
array-and-hashmap
|
O(n^2) | Aug 27, 2022 | |
|
Check if a string contains all binary codes of size k
array-and-hashmap
|
O(n*k) | Aug 27, 2022 | |
|
Interval list intersections
intervals
|
O(n+m) | Aug 27, 2022 | |
|
Number of smooth descent periods of a stock
dynamic-programming
|
O(n) | Aug 27, 2022 | |
|
Remove k digits
stack
|
O(n) | Aug 27, 2022 | |
|
Swap nodes in pairs
linked-list
|
O(n) | Aug 27, 2022 | |
|
Minimum number of flips to make the binary string alternating
greedy
|
O(n) | Aug 26, 2022 | |
|
Reordered power of 2
bit-manipulation
|
O(n^2) | Aug 26, 2022 | |
|
Compare version numbers
two-pointers
|
O(n) | Aug 25, 2022 | |
|
Count servers that communicate
graph
|
O(n*m) | Aug 25, 2022 | |
|
Ransom note
array-and-hashmap
|
O(n+m) | Aug 25, 2022 | |
|
Power of three
math-and-geometry
|
O(log(n)) | Aug 24, 2022 | |
|
Rotate list
linked-list
|
O(n) | Aug 24, 2022 | |
|
Palindrome linked list
linked-list
|
O(n) | Aug 23, 2022 | |
|
Check if a word occurs as a prefix of any word in a sentence
array-and-hashmap
|
O(n) | Aug 22, 2022 | |
|
Minimum deletions to make string balanced
dynamic-programming
|
O(n) | Aug 22, 2022 | |
|
Power of four
math-and-geometry
|
O(log(n)) | Aug 22, 2022 | |
|
Check if the sentence is pangram
array-and-hashmap
|
O(n) | Aug 21, 2022 | |
|
Construct binary tree from preorder and postorder traversal
tree
|
O(n) | Aug 21, 2022 | |
|
Cousins in binary tree
tree
|
O(n) | Aug 21, 2022 | |
|
Number of good ways to split a string
array-and-hashmap
|
O(n) | Aug 21, 2022 | |
|
Stamping the sequence
greedy
|
O(n^2*m) | Aug 21, 2022 | |
|
Minimum number of refueling stops
heap
|
O(n*log(n)) | Aug 20, 2022 | |
|
Number of pairs of strings with concatenation equal to target
array-and-hashmap
|
O(n) | Aug 20, 2022 | |
|
The k weakest rows in a matrix
heap
|
O(n*m*log(k)) | Aug 20, 2022 | |
|
Design parking system
array-and-hashmap
design
|
O(1) | Aug 19, 2022 | |
|
Split array into consecutive subsequences
array-and-hashmap
|
O(n) | Aug 19, 2022 | |
|
Reduce array size to the half
array-and-hashmap
|
O(n*log(n)) | Aug 18, 2022 | |
|
Strange printer
dynamic-programming
|
O(n^2) | Aug 18, 2022 | |
|
Beautiful arrangement
backtracking
|
O(n^2) | Aug 17, 2022 | |
|
Unique morse code words
array-and-hashmap
|
O(n*m) | Aug 17, 2022 | |
|
Find triangular sum of an array
math-and-geometry
|
O(n^2) | Aug 16, 2022 | |
|
First unique character in a string
array-and-hashmap
|
O(n) | Aug 16, 2022 | |
|
N-th tribonacci number
dynamic-programming
|
O(n) | Aug 16, 2022 | |
|
String to integer atoi
math-and-geometry
|
O(n) | Aug 16, 2022 | |
|
Prime number of set bits in binary representation
bit-manipulation
|
O(n^2) | Aug 15, 2022 | |
|
Roman to integer
math-and-geometry
|
O(n) | Aug 15, 2022 | |
|
Next greater element I
stack
|
O(n*m) | Aug 14, 2022 | |
|
Word ladder II
graph
|
O((n+m)*l) | Aug 14, 2022 | |
|
Design circular queue
queue
design
|
O(1) | Aug 13, 2022 | |
|
Distinct subsequences
dynamic-programming
|
O(n*m) | Aug 13, 2022 | |
|
Edit distance
dynamic-programming
|
O(n*m) | Aug 13, 2022 | |
|
Regular expression matching
dynamic-programming
|
O(n*m) | Aug 13, 2022 | |
|
Stream of characters
trie
|
O(n) | Aug 13, 2022 | |
|
Substring with concatenation of all words
sliding-window
|
O(n*w) | Aug 13, 2022 | |
|
Best time to buy and sell stock with cooldown
dynamic-programming
|
O(n) | Aug 12, 2022 | |
|
Interleaving string
dynamic-programming
|
O(n*m) | Aug 12, 2022 | |
|
Longest common subsequence
dynamic-programming
|
O(n*m) | Aug 12, 2022 | |
|
Longest increasing path in a matrix
dynamic-programming
|
O(n*m) | Aug 12, 2022 | |
|
Redundant connection
graph
|
O(n*log(n)) | Aug 12, 2022 | |
|
Walls and gates
graph
|
O(n*m) | Aug 12, 2022 | |
|
Word ladder
graph
|
O(n^2) | Aug 12, 2022 | |
|
Pacific atlantic water flow
graph
|
O(n*m) | Aug 11, 2022 | |
|
Partition equal subset sum
dynamic-programming
|
O(sum(n)) | Aug 11, 2022 | |
|
Surrounded regions
graph
|
O(n*m) | Aug 11, 2022 | |
|
Convert sorted array to binary search tree
tree
|
O(n) | Aug 10, 2022 | |
|
Decode ways
dynamic-programming
|
O(n) | Aug 10, 2022 | |
|
Maximum product subarray
dynamic-programming
|
O(n) | Aug 10, 2022 | |
|
Partition labels
greedy
|
O(n) | Aug 10, 2022 | |
|
Word break
dynamic-programming
|
O(n) | Aug 10, 2022 | |
|
Binary trees with factors
dynamic-programming
|
O(n^2) | Aug 9, 2022 | |
|
Hand of straights
greedy
|
O(n*log(n)) | Aug 9, 2022 | |
|
Longest palindromic substring
dynamic-programming
|
O(n) | Aug 9, 2022 | |
|
Merge triplets to form target triplet
greedy
|
O(n) | Aug 9, 2022 | |
|
Valid parenthesis string
greedy
|
O(n) | Aug 9, 2022 | |
|
Clone graph
graph
|
O(n) | Aug 8, 2022 | |
|
Gas station
greedy
|
O(n) | Aug 8, 2022 | |
|
House robber II
dynamic-programming
|
O(n) | Aug 8, 2022 | |
|
Longest increasing subsequence
dynamic-programming
|
O(nlog(n)) | Aug 8, 2022 | |
|
Palindromic substrings
dynamic-programming
|
O(n) | Aug 8, 2022 | |
|
Count vowels permutation
dynamic-programming
|
O(n) | Aug 7, 2022 | |
|
Detect squares
math-and-geometry
|
O(1) | Aug 7, 2022 | |
|
Find median from data stream
heap
design
|
O(1) | Aug 7, 2022 | |
|
Insert interval
intervals
|
O(n) | Aug 7, 2022 | |
|
Minimum interval to include each query
intervals
|
O(n) | Aug 7, 2022 | |
|
Multiply strings
math-and-geometry
|
O(n*m) | Aug 7, 2022 | |
|
Non overlapping intervals
intervals
|
O(n) | Aug 7, 2022 | |
|
Pow(x, n)
math-and-geometry
|
O(log(n)) | Aug 7, 2022 | |
|
Rotate image
math-and-geometry
|
O(n) | Aug 7, 2022 | |
|
Set matrix zeroes
math-and-geometry
|
O(n) | Aug 7, 2022 | |
|
Spiral matrix
math-and-geometry
|
O(n) | Aug 7, 2022 | |
|
Binary tree maximum path sum
tree
|
O(n) | Aug 6, 2022 | |
|
Design twitter
heap
design
|
O(1) | Aug 6, 2022 | |
|
Kth smallest element in a bst
tree
|
O(n) | Aug 6, 2022 | |
|
Letter combinations of a phone number
backtracking
|
O(n*n!) | Aug 6, 2022 | |
|
Merge k sorted lists
linked-list
|
O(n^2) | Aug 6, 2022 | |
|
Poor pigs
math-and-geometry
|
O(log(n)) | Aug 6, 2022 | |
|
Reverse nodes in k group
linked-list
|
O(n) | Aug 6, 2022 | |
|
Serialize and deserialize binary tree
tree
design
|
O(n) | Aug 6, 2022 | |
|
Validate binary search tree
tree
|
O(n) | Aug 6, 2022 | |
|
Coin change 2
dynamic-programming
|
O(n*a) | Aug 5, 2022 | |
|
Combination sum II
backtracking
|
O(2^n) | Aug 5, 2022 | |
|
Combination sum IV
dynamic-programming
|
O(n*t) | Aug 5, 2022 | |
|
Combination sum
backtracking
|
O(2^n) | Aug 5, 2022 | |
|
LRU cache
linked-list
design
|
O(1) | Aug 5, 2022 | |
|
Find minimum in rotated sorted array
binary-search
|
O(log(n)) | Aug 4, 2022 | |
|
Find the duplicate number
linked-list
|
O(n) | Aug 4, 2022 | |
|
Median of two sorted arrays
binary-search
|
— | Aug 4, 2022 | |
|
Mirror reflection
math-and-geometry
|
O(n) | Aug 4, 2022 | |
|
Search in rotated sorted array
binary-search
|
O(log(n)) | Aug 4, 2022 | |
|
Minimum window substring
sliding-window
|
O(n) | Aug 3, 2022 | |
|
My calendar I
tree
|
O(log(n)) | Aug 3, 2022 | |
|
Sliding window maximum
sliding-window
|
O(n) | Aug 3, 2022 | |
|
Find eventual safe states
graph
|
O(n) | Aug 2, 2022 | |
|
Kth smallest element in a sorted matrix
heap
|
O(m*n*log(k)) | Aug 2, 2022 | |
|
Permutation in string
sliding-window
|
O(n) | Aug 2, 2022 | |
|
Add two numbers
linked-list
|
O(n) | Aug 1, 2022 | |
|
Copy list with random pointer
linked-list
|
O(n) | Aug 1, 2022 | |
|
Koko eating bananas
binary-search
|
— | Aug 1, 2022 | |
|
Reorder list
linked-list
|
O(n) | Aug 1, 2022 | |
|
Climbing stairs
dynamic-programming
|
O(n) | Jul 31, 2022 | |
|
Largest number at least twice of others
array-and-hashmap
|
O(n) | Jul 31, 2022 | |
|
Min cost climbing stairs
dynamic-programming
|
O(n) | Jul 31, 2022 | |
|
Perfect squares
dynamic-programming
|
O(n*a) | Jul 31, 2022 | |
|
reverse-integer
bit-manipulation
|
O(1) | Jul 31, 2022 | |
|
Sum of two integers
math-and-geometry
|
O(1) | Jul 31, 2022 | |
|
Car fleet
stack
|
O(n) | Jul 30, 2022 | |
|
Daily temperatures
stack
|
O(n) | Jul 30, 2022 | |
|
Largest rectangle in histogram
stack
|
O(n) | Jul 30, 2022 | |
|
Top k frequent words
heap
|
O(n + k * log(n)) | Jul 30, 2022 | |
|
Word search II
trie
|
O(n*m*4^(n+k)) | Jul 30, 2022 | |
|
Word subsets
array-and-hashmap
|
O(n*m) | Jul 30, 2022 | |
|
Find and replace pattern
array-and-hashmap
|
O(n) | Jul 29, 2022 | |
|
Generate parentheses
stack
|
O(2^n) | Jul 29, 2022 | |
|
Longest consecutive sequence
array-and-hashmap
|
O(n) | Jul 29, 2022 | |
|
Longest repeating character replacement
sliding-window
|
O(n) | Jul 29, 2022 | |
|
Search suggestions system
array-and-hashmap
|
O(n*m) | Jul 29, 2022 | |
|
Happy number
math-and-geometry
|
O(n) | Jul 28, 2022 | |
|
Min cost to connect all points
graph
|
O(n^2 * log(n)) | Jul 28, 2022 | |
|
Palindrome partitioning
backtracking
|
O(2^n) | Jul 28, 2022 | |
|
reconstruct-itinerary
graph
|
O(E^2) | Jul 28, 2022 | |
|
Swim in rising water
graph
|
O(n^2 * log(n)) | Jul 28, 2022 | |
|
Flatten binary tree to linked list
tree
|
O(n) | Jul 27, 2022 | |
|
Alien dictionary
graph
|
O(n) | Jul 26, 2022 | |
|
Cheapest flights within k stops
graph
|
O(n*k) | Jul 26, 2022 | |
|
Count good nodes in binary tree
tree
|
O(n) | Jul 26, 2022 | |
|
Lowest common ancestor of a binary tree
tree
|
O(n) | Jul 26, 2022 | |
|
Network delay time
graph
|
O(E*logV) | Jul 26, 2022 | |
|
Verifying an alien dictionary
graph
|
O(n*k) | Jul 26, 2022 | |
|
Brust balloons
dynamic-programming
|
O(n^3) | Jul 25, 2022 | |
|
Find first and last position of element in sorted array
binary-search
|
O(log(n)) | Jul 25, 2022 | |
|
Number of connected components in an undirected graph
graph
|
O(n*e) | Jul 25, 2022 | |
|
Trapping rain water
two-pointers
|
O(n) | Jul 25, 2022 | |
|
Implement queue using stacks
queue
design
|
O(1) | Jul 24, 2022 | |
|
Longest substring without repeating characters
sliding-window
|
O(n) | Jul 24, 2022 | |
|
Permutations II
backtracking
|
O(n^2) | Jul 24, 2022 | |
|
Permutations
backtracking
|
O(n*n!) | Jul 24, 2022 | |
|
Search a 2d matrix II
binary-search
|
O(m*n) | Jul 24, 2022 | |
|
Search a 2d matrix
binary-search
|
O(log(n)) | Jul 24, 2022 | |
|
Subsets II
backtracking
|
O(2^n) | Jul 24, 2022 | |
|
Word search
backtracking
|
O(n*m*4^n) | Jul 24, 2022 | |
|
3Sum
two-pointers
|
O(n^2) | Jul 23, 2022 | |
|
Design add and search words data structure
trie
design
|
O(n) | Jul 23, 2022 | |
|
K closest points to origin
heap
|
O(nlog(n)) | Jul 23, 2022 | |
|
Kth largest element in an array
heap
|
O(n) | Jul 23, 2022 | |
|
Last stone weight
heap
|
O(nlog(n)) | Jul 23, 2022 | |
|
Meeting rooms II
intervals
heap
|
O(nlog(n)) | Jul 23, 2022 | |
|
Plus one
math-and-geometry
|
O(n) | Jul 23, 2022 | |
|
Remove nth node from end of list
linked-list
|
O(n) | Jul 23, 2022 | |
|
Subsets
backtracking
|
O(2^n) | Jul 23, 2022 | |
|
Task scheduler
heap
|
O(n) | Jul 23, 2022 | |
|
Time based key value store
binary-search
design
|
O(1) | Jul 23, 2022 | |
|
Jump game II
greedy
|
O(n) | Jul 22, 2022 | |
|
Jump game
greedy
|
O(n) | Jul 22, 2022 | |
|
N-queens
backtracking
|
O(n^2) | Jul 22, 2022 | |
|
Partition list
linked-list
|
O(n) | Jul 22, 2022 | |
|
Fibonacci number
dynamic-programming
|
O(n) | Jul 21, 2022 | |
|
Graph valid tree
graph
|
O(n) | Jul 21, 2022 | |
|
Implement stack using queues
queue
design
|
O(1) | Jul 21, 2022 | |
|
Implement trie prefix tree
trie
design
|
O(n) | Jul 21, 2022 | |
|
Maximum subarray
greedy
|
O(n) | Jul 21, 2022 | |
|
Meeting rooms
intervals
|
O(nlog(n)) | Jul 21, 2022 | |
|
Merge intervals
intervals
|
O(n) | Jul 21, 2022 | |
|
Prime number of set bits in binary representation
math-and-geometry
|
O(n) | Jul 21, 2022 | |
|
Binary tree inorder traversal
tree
|
O(n) | Jul 20, 2022 | |
|
Binary tree postorder traversal
tree
|
O(n) | Jul 20, 2022 | |
|
Binary tree preorder traversal
tree
|
O(n) | Jul 20, 2022 | |
|
Kth largest element in a stream
heap
|
O(1) | Jul 20, 2022 | |
|
N-ary tree postorder traversal
tree
|
O(n) | Jul 20, 2022 | |
|
N-ary tree preorder traversal
tree
|
O(n) | Jul 20, 2022 | |
|
Binary search
binary-search
|
O(log(n)) | Jul 19, 2022 | |
|
Evaluate reverse polish notation
stack
|
O(n) | Jul 19, 2022 | |
|
Linked list cycle
linked-list
|
O(n) | Jul 19, 2022 | |
|
Min stack
stack
design
|
O(n+n) | Jul 19, 2022 | |
|
Pascals triangle
array-and-hashmap
|
O(n) | Jul 19, 2022 | |
|
Path sum
tree
|
O(n) | Jul 19, 2022 | |
|
Encode and decode string
array-and-hashmap
|
O(n) | Jul 18, 2022 | |
|
Find largest value in each tree row
tree
|
O(n) | Jul 18, 2022 | |
|
Lowest common ancestor of a binary search tree
tree
|
O(n) | Jul 18, 2022 | |
|
Minimum path sum
dynamic-programming
|
O(n*m) | Jul 18, 2022 | |
|
Best time to buy and sell stock
sliding-window
|
O(n) | Jul 17, 2022 | |
|
Coin change
dynamic-programming
|
O(n*a) | Jul 17, 2022 | |
|
House robber
dynamic-programming
|
O(n) | Jul 17, 2022 | |
|
Target sum
dynamic-programming
|
O(n*t) | Jul 17, 2022 | |
|
Unique paths
dynamic-programming
|
O(n*m) | Jul 17, 2022 | |
|
Number of 1 bits
bit-manipulation
|
O(n) | Jul 16, 2022 | |
|
Course schedule II
graph
|
O(n+p) | Jul 16, 2022 | |
|
Course schedule
graph
|
O(n+p) | Jul 16, 2022 | |
|
Missing number
bit-manipulation
|
O(n) | Jul 16, 2022 | |
|
Reverse bits
bit-manipulation
|
O(1) | Jul 16, 2022 | |
|
Valid parentheses
stack
|
O(n) | Jul 16, 2022 | |
|
Container with most water
two-pointers
|
O(n) | Jul 15, 2022 | |
|
Merge two sorted list
linked-list
|
O(n) | Jul 15, 2022 | |
|
Reverse linked list
linked-list
|
O(n) | Jul 15, 2022 | |
|
Balanced binary tree
tree
|
O(n) | Jul 14, 2022 | |
|
Construct binary tree from preorder and inorder traversal
tree
|
O(n) | Jul 14, 2022 | |
|
Diameter of binary tree
tree
|
O(n) | Jul 14, 2022 | |
|
Invert binary tree
tree
|
O(n) | Jul 14, 2022 | |
|
Maximum depth of binary tree
tree
|
O(n) | Jul 14, 2022 | |
|
Maximum depth of n-ary tree
tree
|
O(n) | Jul 14, 2022 | |
|
Same tree
tree
|
O(n) | Jul 14, 2022 | |
|
Subtree of another tree
tree
|
O(n^2) | Jul 14, 2022 | |
|
Two sum II - input array is sorted
two-pointers
|
O(n) | Jul 14, 2022 | |
|
Binary tree level order traversal
tree
|
— | Jul 13, 2022 | |
|
Number of 1 bits
bit-manipulation
|
O(n) | Jul 13, 2022 | |
|
Product of array except self
array-and-hashmap
|
O(n) | Jul 13, 2022 | |
|
Single number
bit-manipulation
|
O(n) | Jul 13, 2022 | |
|
Valid palindrome
two-pointers
|
O(n) | Jul 13, 2022 | |
|
Valid sudoku
array-and-hashmap
|
O(n) | Jul 13, 2022 | |
|
Group anagrams
array-and-hashmap
|
— | Jul 12, 2022 | |
|
Rotting oranges
graph
|
O(n*m) | Jul 12, 2022 | |
|
Top k frequent element
array-and-hashmap
|
O(n) | Jul 12, 2022 | |
|
Valid anagram
array-and-hashmap
|
O(n) | Jul 12, 2022 | |
|
Binary tree right side view
tree
|
O(n) | Jul 11, 2022 | |
|
Max area of island
graph
|
O(n*m) | Jul 11, 2022 | |
|
Contains duplicate
array-and-hashmap
|
O(n) | Jul 10, 2022 | |
|
Two sum
array-and-hashmap
|
O(n) | Jul 10, 2022 |
No matching problems
Try clearing one of the filters.