Home

Awesome

LeetCode by Swift

LeetCode Online Judge is a website containing many algorithm questions. Most of them are real interview questions of Google, Facebook, LinkedIn, Apple, etc. This repo shows my solutions by Swift with the code style strictly follows the RayWenderlich Swift Style Guide. Please feel free to reference and STAR to support this repo, thank you!

Leetcode

Progress

Problem Status shows the latest progress to all 1000+ questions. Currently we have 400+ completed solutions. Note: questions with ♥ mark means that you have to Subscript to premium membership of LeetCode to unlock them.

Contributors

<p align="center"> <img src="./Leetcode_Contributors.png"> </p>

Data Structures

Companies

Array

TitleSolutionDifficultyTimeSpace
Verify an Alien DictionarySwiftEasyO(n)O(n)
Sort Array By ParitySwiftEasyO(n)O(n)
Max Consecutive OnesSwiftEasyO(n)O(1)
HeatersSwiftEasyO(nlogn)O(1)
Number of BoomerangsSwiftEasyO(n ^ 2)O(n)
Island PerimeterSwiftEasyO(nm)O(1)
Majority ElementSwiftEasyO(n)O(1)
Majority Element IISwiftMediumO(n)O(1)
First Missing PositiveSwiftHardO(n)O(n)
Intersection of Two ArraysSwiftEasyO(n)O(n)
Intersection of Two Arrays IISwiftEasyO(n)O(n)
Contains DuplicateSwiftEasyO(n)O(n)
Contains Duplicate IISwiftEasyO(n)O(n)
Remove Duplicates from Sorted ArraySwiftEasyO(n)O(1)
Remove Duplicates from Sorted Array IISwiftMediumO(n)O(1)
Move ZeroesSwiftEasyO(n)O(1)
Remove ElementSwiftEasyO(n)O(1)
Strobogrammatic NumberSwiftEasyO(n)O(1)
Can Place FlowersSwiftEasyO(n)O(1)
Two SumSwiftEasyO(n)O(n)
Two Sum II - Input array is sortedSwiftEasyO(n)O(1)
Two Sum III - Data structure designSwiftEasyO(n)O(1)
Two Sum Less Than KSwiftEasyO(nlogn)O(n)
3SumSwiftMediumO(n^2)O(nC3)
3Sum ClosestSwiftMediumO(n^2)O(nC3)
4SumSwiftMediumO(n^3)O(nC4)
Increasing Triplet SubsequenceSwiftMediumO(n)O(1)
Summary RangesSwiftMediumO(n)O(n)
Range Sum Query 2D - ImmutableSwiftMediumO(mn)O(mn)
Missing RangesSwiftMediumO(n)O(1)
Asteroid CollisionSwiftMediumO(n)O(n)
Maximize Distance to Closest PersonSwiftEasyO(n)O(1)
Exam RoomSwiftMediumO(n)O(n)
Shortest Word DistanceSwiftEasyO(n)O(1)
Shortest Word Distance IISwiftMediumO(n)O(n)
Shortest Word Distance IIISwiftMediumO(n)O(1)
Minimum Size Subarray SumSwiftMediumO(n)O(1)
Maximum Size Subarray Sum Equals kSwiftMediumO(n)O(n)
Smallest RangeSwiftHardO(nm)O(nm)
Product of Array Except SelfSwiftMediumO(n)O(1)
Rotate ArraySwiftEasyO(n)O(1)
Rotate ImageSwiftMediumO(n^2)O(1)
Spiral MatrixSwiftMediumO(n^2)O(1)
Spiral Matrix IISwiftMediumO(n^2)O(1)
Diagonal TraverseSwiftMediumO(mn)O(1)
Valid SudokuSwiftEasyO(n^2)O(n)
Set Matrix ZeroSwiftMediumO(n^2)O(1)
Next PermutationSwiftMediumO(n)O(1)
Gas StationSwiftMediumO(n)O(1)
Game of LifeSwiftMediumO(n)O(1)
Task SchedulerSwiftMediumO(nlogn)O(n)
Validate IP AddressSwiftMediumO(n)O(1)
Sliding Window Maximum SwiftHardO(n)O(n)
Longest Consecutive SequenceSwiftHardO(n)O(n)
Create Maximum NumberSwiftHardO(n^2)O(n)
Find All Numbers Disappeared in an ArraySwiftEasyO(n)O(1)

String

TitleSolutionDifficultyTimeSpace
Fizz BuzzSwiftEasyO(n)O(1)
First Unique Character in a StringSwiftEasyO(n)O(1)
Keyboard RowSwiftEasyO(nm)O(n)
Valid Word AbbreviationSwiftEasyO(n)O(n)
Valid PalindromeSwiftEasyO(n)O(n)
Valid Palindrome IISwiftEasyO(n)O(n)
Detect CapitalSwiftEasyO(n)O(1)
Count and SaySwiftEasyO(n^2)O(1)
Flip GameSwiftEasyO(n)O(n)
Implement strStr()SwiftEasyO(nm)O(n)
Isomorphic StringsSwiftEasyO(n)O(n)
Reverse StringSwiftEasyO(n)O(n)
Reverse String IISwiftEasyO(n)O(n)
Reverse Vowels of a StringSwiftEasyO(n)O(n)
Reverse Words in a StringSwiftMediumO(n)O(1)
Reverse Words in a String IISwiftMediumO(n)O(1)
Reverse Words in a String IIISwiftEasyO(n)O(1)
Length of Last WordSwiftEasyO(n)O(n)
String CompressionSwiftEasyO(n)O(1)
Add StringsSwiftEasyO(n)O(1)
Shortest Distance to a CharacterSwiftEasyO(n)O(1)
Multiply StringsSwiftMediumO(n)O(1)
Palindrome PermutationSwiftEasyO(n)O(n)
Valid AnagramSwiftEasyO(n)O(n)
Ransom NoteSwiftEasyO(n)O(n)
Group AnagramsSwiftMediumO(nmlogm + nlogn)O(n)
Find Duplicate File in SystemSwiftMediumO(nm)O(n)
Longest Common PrefixSwiftEasyO(nm)O(m)
Longest Substring Without Repeating CharactersSwiftMediumO(n)O(n)
One Edit DistanceSwiftMediumO(n)O(n)
Word PatternSwiftEasyO(n)O(n)
Permutation in StringSwiftMediumO(nm)O(n)
Find All Anagrams in a StringSwiftMediumO(n)O(n)
Minimum Window SubstringSwiftHardO(n^2)O(n)
Longest Substring with At Most Two Distinct CharactersSwiftHardO(n)O(n)
Longest Substring with At Most K Distinct CharactersSwiftHardO(n)O(n)
Text JustificationSwiftHardO(n)O(n)
Find the Closest PalindromeSwiftHardO(n)O(n)

Linked List

TitleSolutionDifficultyTimeSpace
Reverse Linked ListSwiftEasyO(n)O(1)
Palindrome Linked ListSwiftEasyO(n)O(1)
Swap Nodes in PairsSwiftEasyO(n)O(1)
Remove Linked List ElementsSwiftEasyO(n)O(1)
Remove Duplicates from Sorted ListSwiftEasyO(n)O(1)
Remove Duplicates from Sorted List IISwiftMediumO(n)O(1)
Remove Nth Node From End of ListSwiftEasyO(n)O(1)
Odd Even Linked ListSwiftMediumO(n)O(1)
Rotate ListSwiftMediumO(n)O(1)
Reorder ListSwiftMediumO(n)O(1)
Merge Two Sorted ListsSwiftEasyO(n)O(1)
Merge k Sorted ListsSwiftHardO(mlogn)O(1)
Partition ListSwiftMediumO(n)O(1)
Reverse Nodes in k-GroupSwiftHardO(n)O(1)
LRU CacheSwiftHardO(1)O(1)
LFU CacheSwiftHardO(1)O(1)

Stack

TitleSolutionDifficultyTimeSpace
Min StackSwiftEasyO(1)O(n)
Max StackSwiftEasyO(n)O(n)
Valid ParenthesesSwiftEasyO(n)O(n)
Longest Valid ParenthesesSwiftHardO(n)O(n)
Evaluate Reverse Polish NotationSwiftMediumO(n)O(n)
Exclusive Time of FunctionsSwiftMediumO(n)O(n)
Simplify PathSwiftMediumO(n)O(n)
Remove K DigitsSwiftMediumO(n)O(n)
Ternary Expression ParserSwiftMediumO(n)O(n)
Binary Tree Preorder TraversalSwiftMediumO(n)O(n)
Binary Tree Inorder TraversalSwiftMediumO(n)O(n)
Binary Search Tree IteratorSwiftMediumO(n)O(n)
Binary Tree Postorder TraversalSwiftHardO(n)O(n)
Decode StringSwiftMediumO(n)O(n)
Basic CalculatorSwiftHardO(n)O(n)

Queue

TitleSolutionDifficultyTimeSpace
Implement Queue using StacksSwiftEasyO(n)O(n)

Tree

TitleSolutionDifficultyTimeSpace
Same TreeSwiftEasyO(n)O(n)
Symmetric TreeSwiftEasyO(n)O(n)
Invert Binary TreeSwiftEasyO(n)O(n)
Binary Tree Upside DownSwiftMediumO(n)O(1)
Minimum Depth of Binary TreeSwiftEasyO(n)O(1)
Maximum Depth of Binary TreeSwiftEasyO(n)O(1)
Diameter of Binary TreeSwiftEasyO(n)O(1)
Balanced Binary TreeSwiftEasyO(n)O(n)
Sum of Left LeavesSwiftEasyO(n)O(1)
Flatten Binary Tree to Linked ListSwiftMediumO(n)O(1)
Convert Sorted Array to Binary Search TreeSwiftEasyO(n)O(1)
Validate Binary Search TreeSwiftMediumO(n)O(log n)
Binary Tree Level Order TraversalSwiftEasyO(n)O(n)
Binary Tree Level Order Traversal IISwiftEasyO(n)O(n)
Merge Two Binary TreesSwiftEasyO(n)O(n)
Binary Tree Zigzag Level Order TraversalSwiftMediumO(n)O(n)
Binary Tree Vertical Order TraversalSwiftMediumO(n)O(n)
Kth Smallest Element in a BSTSwiftMediumO(n)O(n)
Binary Tree Right Side ViewSwiftMediumO(n)O(n)
Construct Binary Tree from Preorder and Inorder TraversalSwiftMediumO(nlogn)O(1)
Construct Binary Tree from Inorder and Postorder TraversalSwiftMediumO(nlogn)O(1)
Path SumSwiftEasyO(n)O(n)
Path Sum IISwiftMediumO(n)O(n)
Path Sum IIISwiftEasyO(n^2)O(1)
Binary Tree PathsSwiftEasyO(n)O(n)
Binary Tree Maximum Path SumSwiftHardO(n)O(1)
House Robber IIISwiftMediumO(n)O(1)
Unique Binary Search TreesSwiftMediumO(n^2)O(n)
Recover Binary Search TreeSwiftHardO(n)O(1)
Serialize and Deserialize Binary TreeSwiftHardO(n)O(n)
Serialize and Deserialize N-ary TreeSwiftHardO(n)O(n)

Dynamic programming

TitleSolutionDifficultyTimeSpace
Nested List Weight SumSwiftEasyO(n)O(1)
Climbing StairsSwiftEasyO(n)O(1)
Min Cost Climbing StairsSwiftEasyO(n)O(n)
Unique PathsSwiftMediumO(mn)O(mn)
Unique Paths IISwiftMediumO(mn)O(mn)
Nested List Weight Sum IISwiftMediumO(n)O(n)
Flip Game IISwiftMediumO(n)O(n)
Can I WinSwiftMediumO(2^n)O(n)
Decode WaysSwiftMediumO(n)O(n)
Minimum Path SumSwiftMediumO(mn)O(mn)
Generate ParenthesesSwiftMediumO(2^n)O(n)
Different Ways to Add ParenthesesSwiftMediumO(n^n)O(n)
Best Time to Buy and Sell StockSwiftEasyO(n)O(1)
Best Time to Buy and Sell Stock IISwiftMediumO(n)O(1)
Best Time to Buy and Sell Stock IIISwiftHardO(n)O(n)
Best Time to Buy and Sell Stock IVSwiftHardO(n^2)O(n)
Best Time to Buy and Sell Stock with CooldownSwiftMediumO(n^2)O(n)
Maximum Sum of 3 Non-Overlapping SubarraysSwiftHardO(n)O(n)
Coin ChangeSwiftMediumO(n^2)O(n)
Coin Change IISwiftMediumO(n^2)O(n)
Paint HouseSwiftEasyO(n)O(n)
Paint House IISwiftHardO(n)O(1)
Longest Increasing SubsequenceSwiftMediumO(nlogn)O(n)
Longest Common SubsequenceSwiftMediumO(mn)O(1)
Palindromic SubstringsSwiftMediumO(n^2)O(n^2)
Longest Palindromic SubstringSwiftMediumO(n^2)O(n^2)
Perfect SquaresSwiftMediumO(n^2)O(n)
House RobberSwiftEasyO(n)O(1)
House Robber IISwiftMediumO(n)O(1)
Paint FenceSwiftEasyO(n)O(n)
Maximum SubarraySwiftMediumO(n)O(1)
Maximum Product SubarraySwiftMediumO(n)O(1)
Maximum Number of Points with CostSwiftMediumO(mn)O(1)
Maximal SquareSwiftMediumO(mn)O(mn)
Edit DistanceSwiftHardO(mn)O(mn)
Combination Sum IVSwiftMediumO(2^n)O(n)
TriangleSwiftMediumO(2^n)O(m)
Wiggle SubsequenceSwiftMediumO(n)O(1)
Wildcard MatchingSwiftHardO(mn)O(mn)
Regular Expression MatchingSwiftHardO(mn)O(mn)
Minimum Window SubsequenceSwiftHardO(mn)O(mn)
Guess Number Higher or Lower IISwiftMediumO(nlogn)O(n^2)
Burst BallonsSwiftHardO(n^3)O(n)
Frog JumpSwiftHardO(n^2)O(n)
Jump GameSwiftMediumO(n)O(1)
Dungeon GameSwiftHardO(nm)O(nm)

Depth-first search

TitleSolutionDifficultyTimeSpace
PermutationsSwiftMediumO(2^n)O(n)
Permutations IISwiftMediumO(2^n)O(n)
SubsetsSwiftMediumO(n^n)O(n)
Subsets IISwiftMediumO(2^n)O(n)
CombinationsSwiftMediumO(2^n)O(n)
Combination SumSwiftMediumO(2^n)O(n)
Combination Sum IISwiftMediumO(2^n)O(n)
Combination Sum IIISwiftMediumO(2^n)O(n)
Letter Combinations of a Phone NumberSwiftMediumO(4^n)O(n)
Factor CombinationsSwiftMediumO(n^n))O(2^n - 1)
Strobogrammatic Number IISwiftMediumO(m^n)O(n)
Generalized AbbreviationSwiftMediumO(n^n)O(2^n)
Palindrome PartitioningSwiftMediumO(n^n)O(n)
Is Graph BipartiteSwiftMediumO(n)O(n)
Number of IslandsSwiftMediumO((mn)^2)O(1)
Walls and GatesSwiftMediumO(n^n)O(2^n)
Word SearchSwiftMediumO((mn * 4 ^ (k - 1))O(mn)
Word Search IISwiftHardO(((mn)^2))O(n^2)
Add and Search Word - Data structure designSwiftMediumO(n)O(n)
Partition to K Equal Sum SubsetsSwiftMediumO(k^n)O(n)
N-QueensSwiftHardO((n^n))O(n^2)
N-Queens IISwiftHardO((n^n))O(n)
Word SquaresSwiftHardO((n^2))O(n^2)
Word Pattern IISwiftHardO(n^n)O(n)
Sudoku SolverSwiftHardO(n^4)O(1)
Remove Invalid ParenthesesSwiftHardO(n^n)O(n)
Expression Add OperatorsSwiftHardO(n^n)O(n)

Breadth-first search

TitleSolutionDifficultyTimeSpace
Word LadderSwiftMediumO(nm)O(nm)
Evaluate DivisionSwiftMediumO(n^2)O(n)
Shortest Distance from All BuildingsSwiftHardO((mn)^2)O(mn)

Math

TitleSolutionDifficultyTimeSpace
Add BinarySwiftEasyO(n)O(n)
Add Two NumbersSwiftMediumO(n)O(1)
Add DigitsSwiftEasyO(1)O(1)
Plus OneSwiftEasyO(n)O(1)
Missing NumberSwiftEasyO(n)O(1)
Divide Two IntegersSwiftMediumO(logn)O(1)
Number ComplementSwiftEasyO(n)O(1)
Hamming DistanceSwiftEasyO(n)O(1)
Integer BreakSwiftMediumO(logn)O(1)
Factorial Trailing ZeroesSwiftMediumO(logn)O(1)
Happy NumberSwiftEasyO(n)O(n)
Single NumberSwiftMediumO(n)O(1)
Ugly NumberSwiftEasyO(logn)O(1)
Ugly Number IISwiftMediumO(n)O(n)
Super Ugly NumberSwiftMediumO(n^2)O(n)
Count PrimesSwiftEasyO(n)O(n)
String to Integer (atoi)SwiftEasyO(n)O(1)
Fraction to Recurring DecimalSwiftMediumO(logn)O(n)
Pow(x, n)SwiftMediumO(logn)O(1)
Power of TwoSwiftEasyO(1)O(1)
Power of ThreeSwiftEasyO(1)O(1)
Super PowerSwiftMediumO(n)O(1)
Sum of Two IntegersSwiftEasyO(n)O(1)
Reverse IntegerSwiftEasyO(n)O(1)
Excel Sheet Column NumberSwiftEasyO(n)O(1)
Integer to RomanSwiftMediumO(n)O(1)
Roman to IntegerSwiftEasyO(n)O(n)
Integer to English WordsSwiftHardO(n)O(1)
Sparse Matrix MultiplicationSwiftMediumO(n^3)O(n^2)
Rectangle AreaSwiftEasyO(1)O(1)
Minimum Moves to Equal Array ElementsSwiftEasyO(n)O(1)
Pour WaterSwiftHardO(n)O(n)
Trapping Rain WaterSwiftMediumO(nk)O(1)
Container With Most WaterSwiftMediumO(n)O(1)
Counting BitsSwiftMediumO(n)O(n)
K-th Smallest in Lexicographical OrderSwiftHardO(n)O(1)
Gary CodeSwiftMediumO(n)O(2^n)
Permutation SequenceSwiftMediumO(n^2)O(1)
Line ReflectionSwiftMediumO(n)O(n)
Valid NumberSwiftHardO(n)O(1)

Search

TitleSolutionDifficultyTimeSpace
Closest Binary Search Tree ValueSwiftEasyO(logn)O(1)
Closest Binary Search Tree Value IISwiftHardO(n)O(n)
Search in Rotated Sorted ArraySwiftHardO(logn)O(1)
Search in Rotated Sorted Array IISwiftMediumO(logn)O(1)
Find Minimum in Rotated Sorted ArraySwiftMediumO(logn)O(1)
Find Minimum in Rotated Sorted Array IISwiftHardO(logn)O(1)
Search a 2D MatrixSwiftMediumO(log(m + n))O(1)
Search a 2D Matrix IISwiftMediumO(m + n)O(1)
Search for a RangeSwiftMediumO(logn)O(1)
Search Insert PositionSwiftMediumO(logn)O(1)
Peak Index in a Mountain ArraySwiftEasyO(logn)O(1)
Find Peak ElementSwiftMediumO(logn)O(1)
Random Pick with WeightSwiftMediumO(logn)O(1)
Sqrt(x)SwiftMediumO(logn)O(1)
Median of Two Sorted ArraysSwiftHardO(log(m + n))O(1)
Minimize Max Distance to Gas StationSwiftHardO(nlogm)O(1)

Sort

TitleSolutionDifficultyTimeSpace
Merge Sorted ArraySwiftEasyO(n)O(1)
Sort ColorsSwiftMediumO(n)O(1)
Wiggle SortSwiftMediumO(n)O(1)
Wiggle Sort IISwiftMediumO(nlogn)O(n)
Sort Transformed ArraySwiftMediumO(n)O(1)
Top K Frequent ElementsSwiftMediumO(nlogn)O(n)
Meeting RoomsSwiftEasyO(nlogn)O(1)
Meeting Rooms IISwiftMediumO(nlogn)O(n)
Merge IntervalsSwiftHardO(nlogn)O(n)
Alien DictionarySwiftHardO(nm)O(nm)
Kth Largest Element in an ArraySwiftMediumO(nlogn)O(n)
Array Partition ISwiftEasyO(nlogn)O(n)
Insert IntervalSwiftHardO(n)O(1)
Largest NumberSwiftMediumO(nlogn)O(1)

Graph

TitleSolutionDifficultyTimeSpace
Number of Connected Components in an Undirected GraphSwiftMediumO(nlogn)O(n)
Graph Valid TreeSwiftMediumO(nlogn)O(n)
Number of Islands IISwiftHardO(klogmn)O(mn)
Course ScheduleSwiftMediumO(n)O(n)
Course Schedule IISwiftMediumO(n)O(n)

Design

TitleSolutionDifficultyTimeSpace
Shuffle an ArraySwiftEasyO(n)O(1)
Design HashMapSwiftEasyO(n)O(n)
Design Tic-Tac-ToeSwiftMediumO(1)O(n)
Flatten Nested List IteratorSwiftMediumO(n)O(n)
Flatten 2D VectorSwiftMediumO(n)O(n)
Implement Trie (Prefix Tree)SwiftMediumO(n)O(n)
Add and Search Word - Data structure designSwiftMediumO(24^n)O(n)
Insert Delete GetRandom O(1)SwiftMediumO(1)O(n)
LRU CacheSwiftHardO(1)O(n)
All O`one Data StructureSwiftHardO(1)O(n)

Google

TitleSolutionDifficultyFrequency
Race CarSwiftHard★★★★★★
Plus OneSwiftEasy★★★★★★
Number of IslandsSwiftMedium★★★★
Summary RangesSwiftMedium★★★★
Perfect SquaresSwiftMedium★★★★
Merge IntervalsSwiftHard★★★
Valid ParenthesesSwiftEasy★★★
Trapping Rain WaterSwiftHard★★
Merge k Sorted ListsSwiftHard★★
Longest Consecutive SequenceSwiftHard★★
Find Peak ElementSwiftMedium★★
Power of TwoSwiftEasy★★
Spiral MatrixSwiftMedium★★
Sliding Window Maximum SwiftHard★★
Pow(x, n)SwiftMedium★★
Letter Combinations of a Phone NumberSwiftMedium★★
HeatersSwiftEasy

Facebook

TitleSolutionDifficultyFrequency
3SumSwiftMedium★★★★★★
Valid PalindromeSwiftEasy★★★★★★
Valid Palindrome IISwiftEasy★★★★★★
Move ZeroesSwiftEasy★★★★★★
Remove Invalid ParenthesesSwiftHard★★★★★★
Add BinarySwiftEasy★★★★★
Two SumSwiftEasy★★★★★
Binary Tree PathsSwiftEasy★★★★
Letter Combinations of a Phone NumberSwiftMedium★★★★
Merge k Sorted ListsSwiftHard★★★★
Reverse Linked ListSwiftEasy★★★
Merge IntervalsSwiftHard★★★
Number of IslandsSwiftMedium★★★
Reverse Linked ListSwiftEasy★★★
Expression Add OperatorsSwiftHard★★★
SubsetsSwiftMedium★★★
Sort ColorsSwiftMedium★★

Snapchat

TitleSolutionDifficultyFrequency
Game of LifeSwiftMedium★★★★★★
Meeting Rooms IISwiftMedium★★★★★★
Valid SudokuSwiftEasy★★★★★
Binary Tree Vertical Order TraversalSwiftMedium★★★★
Alien DictionarySwiftHard★★★★
One Edit DistanceSwiftMedium★★★
Sudoku SolverSwiftHard★★★
Reverse Linked ListSwiftEasy★★
Unique Binary Search TreesSwiftMedium★★
Minimum Window SubstringSwiftHard★★
Remove K DigitsSwiftMedium
Ternary Expression ParserSwiftMedium

Uber

TitleSolutionDifficultyFrequency
Valid SudokuSwiftEasy★★★★
Spiral MatrixSwiftMedium★★★★
Letter Combinations of a Phone NumberSwiftMedium★★★★
Group AnagramsSwiftMedium★★★★
Word PatternSwiftEasy★★★
Roman to IntegerSwiftEasy★★★
Combination SumSwiftMedium★★

Airbnb

TitleSolutionDifficultyFrequency
Two SumSwiftEasy★★★★★
Text JustificationSwiftHard★★★★
House RobberSwiftEasy★★
Single NumberSwiftMedium★★
Word Search IISwiftHard★★
Add Two NumbersSwiftMedium★★

LinkedIn

TitleSolutionDifficultyFrequency
Maximum SubarraySwiftMedium★★★★★★
Pow(x, n)SwiftMedium★★★★★★
Merge IntervalsSwiftHard★★★★★★
Isomorphic StringsSwiftEasy★★★★★★
Search in Rotated Sorted ArraySwiftHard★★★★★
Search for a RangeSwiftMedium★★★★★
Two SumSwiftEasy★★★★
Binary Tree Level Order TraversalSwiftEasy★★★★
Evaluate Reverse Polish NotationSwiftMedium★★★
Maximum Product SubarraySwiftMedium★★★
Product of Array Except SelfSwiftMedium★★★
Symmetric TreeSwiftEasy★★

Amazon

TitleSolutionDifficultyFrequency
Two SumSwiftEasy★★★★★★
Min Cost Climbing StairsSwiftEasy★★★★
Number of IslandsSwiftMedium★★
Add Two NumbersSwiftMedium★★
Reverse Linked ListSwiftEasy★★
Valid ParenthesesSwiftEasy★★
Longest Palindromic SubstringSwiftMedium★★
Trapping Rain WaterSwiftHard★★
Longest Substring Without Repeating CharactersSwiftMedium★★
Letter Combinations of a Phone NumberSwiftMedium★★
Valid AnagramSwiftEasy★★
Rotate ImageSwiftMedium★★
Best Time to Buy and Sell StockSwiftEasy★★
3SumSwiftMedium★★
Sliding Window Maximum SwiftHard★★

Microsoft

TitleSolutionDifficultyFrequency
Reverse Linked ListSwiftEasy★★★★★★
Two SumSwiftEasy★★★★★
String to Integer (atoi)SwiftEasy★★★★
Add Two NumbersSwiftMedium★★★★
Excel Sheet Column NumberSwiftEasy★★★★
Validate Binary Search TreeSwiftMedium★★★
Merge Two Sorted ListsSwiftEasy★★★

Problem Status

SolutionNumberTitleDifficulty
Swift460LFU CacheHard
Swift448Find All Numbers Disappeared in an ArrayEasy
Swift377Combination Sum IVMedium
376Wiggle SubsequenceMedium
Swift375Guess Number Higher or Lower IIMedium
374Guess Number Higher or LowerEasy
373Find K Pairs with Smallest SumsMedium
Swift372Super PowMedium
Swift371Sum of Two IntegersEasy
370Range AdditionMedium
369Plus One Linked ListMedium
368Largest Divisible SubsetMedium
367Valid Perfect SquareMedium
366Find Leaves of Binary TreeMedium
365Water and Jug ProblemMedium
Swift364Nested List Weight Sum IIMedium
363Max Sum of Rectangle No Larger Than KHard
362Design Hit CounterMedium
361Bomb EnemyMedium
Swift360Sort Transformed ArrayMedium
359Logger Rate LimiterEasy
358Rearrange String k Distance ApartHard
357Count Numbers with Unique DigitsMedium
356Line ReflectionMedium
355Design TwitterMedium
354Russian Doll EnvelopesHard
353Design Snake GameMedium
352Data Stream as Disjoint IntervalsHard
351Android Unlock PatternsMedium
Swift350Intersection of Two Arrays IIEasy
Swift349Intersection of Two ArraysEasy
348Design Tic-Tac-ToeMedium
Swift347Top K Frequent ElementsMedium
346Moving Average from Data StreamEasy
Swift345Reverse Vowels of a StringEasy
Swift344Reverse StringEasy
Swift343Integer BreakMedium
342Power of FourEasy
Swift341Flatten Nested List IteratorMedium
Swift340Longest Substring with At Most K Distinct CharactersHard
Swift339Nested List Weight SumEasy
Swift338Counting BitsMedium
Swift337House Robber IIIMedium
336Palindrome PairsHard
335Self CrossingHard
Swift334Increasing Triplet SubsequenceMedium
333Largest BST SubtreeMedium
332Reconstruct ItineraryMedium
331Verify Preorder Serialization of a Binary TreeMedium
330Patching ArrayHard
329Longest Increasing Path in a MatrixHard
Swift328Odd Even Linked ListMedium
327Count of Range SumHard
Swift326Power of ThreeEasy
Swift325Maximum Size Subarray Sum Equals kMedium
Swift324Wiggle Sort IIMedium
Swift323Number of Connected Components in an Undirected GraphMedium
Swift322Coin ChangeMedium
Swift321Create Maximum NumberHard
Swift320Generalized AbbreviationMedium
319Bulb SwitcherMedium
318Maximum Product of Word LengthsMedium
Swift317Shortest Distance from All BuildingsHard
316Remove Duplicate LettersHard
315Count of Smaller Numbers After SelfHard
Swift314Binary Tree Vertical Order TraversalMedium
Swift313Super Ugly NumberMedium
Swift312Burst BalloonsHard
Swift311Sparse Matrix MultiplicationMedium
310Minimum Height TreesMedium
Swift309Best Time to Buy and Sell Stock with CooldownMedium
308Range Sum Query 2D - MutableHard
307Range Sum Query - MutableMedium
306Additive NumberMedium
Swift305Number of Islands IIHard
Swift304Range Sum Query 2D - ImmutableMedium
303Range Sum Query - ImmutableEasy
302Smallest Rectangle Enclosing Black PixelsHard
Swift301Remove Invalid ParenthesesHard
Swift300Longest Increasing SubsequenceMedium
299Bulls and CowsEasy
298Binary Tree Longest Consecutive SequenceMedium
297Serialize and Deserialize Binary TreeHard
Swift296Best Meeting PointHard
295Find Median from Data StreamHard
Swift294Flip Game IIMedium
Swift293Flip GameEasy
292Nim GameEasy
291Word Pattern IIHard
Swift290Word PatternEasy
Swift289Game of LifeMedium
288Unique Word AbbreviationEasy
287Find the Duplicate NumberHard
Swift286Walls and GatesMedium
285Inorder Successor in BSTMedium
284Peeking IteratorMedium
Swift283Move ZeroesEasy
Swift282Expression Add OperatorsHard
281Zigzag IteratorMedium
Swift280Wiggle SortMedium
Swift279Perfect SquaresMedium
278First Bad VersionEasy
277Find the CelebrityMedium
Swift276Paint FenceEasy
275H-Index IIMedium
274H-IndexMedium
Swift273Integer to English WordsHard
Swift272Closest Binary Search Tree Value IIHard
271Encode and Decode StringsMedium
Swift270Closest Binary Search Tree ValueEasy
Swift269Alien DictionaryHard
Swift268Missing NumberEasy
267Palindrome Permutation IIMedium
Swift266Palindrome PermutationEasy
Swift265Paint House IIHard
Swift264Ugly Number IIMedium
Swift263Ugly NumberEasy
Swift261Graph Valid TreeMedium
260Single Number IIIMedium
2593Sum SmallerMedium
Swift258Add DigitsEasy
Swift257Binary Tree PathsEasy
Swift256Paint HouseMedium
255Verify Preorder Sequence in Binary Search TreeMedium
Swift254Factor CombinationsMedium
Swift253Meeting Rooms IIMedium
Swift252Meeting RoomsEasy
Swift251Flatten 2D VectorMedium
250Count Univalue SubtreesMedium
249Group Shifted StringsEasy
248Strobogrammatic Number IIIHard
Swift247Strobogrammatic Number IIMedium
Swift246Strobogrammatic NumberEasy
Swift245Shortest Word Distance IIIMedium
Swift244Shortest Word Distance IIMedium
Swift243Shortest Word DistanceEasy
Swift242Valid AnagramEasy
Swift241Different Ways to Add ParenthesesMedium
Swift240Search a 2D Matrix IIMedium
Swift239Sliding Window MaximumHard
Swift238Product of Array Except SelfMedium
237Delete Node in a Linked ListEasy
236Lowest Common Ancestor of a Binary TreeMedium
Swift235Lowest Common Ancestor of a Binary Search TreeEasy
Swift234Palindrome Linked ListEasy
233Number of Digit OneHard
Swift232Implement Queue using StacksEasy
Swift231Power of TwoEasy
Swift230Kth Smallest Element in a BSTMedium
Swift229Majority Element IIMedium
Swift228Summary RangesMedium
227Basic Calculator IIMedium
Swift226Invert Binary TreeEasy
225Implement Stack using QueuesEasy
Swift224Basic CalculatorHard
Swift223Rectangle AreaEasy
222Count Complete Tree NodesMedium
Swift221Maximal SquareMedium
220Contains Duplicate IIIMedium
Swift219Contains Duplicate IIEasy
218The Skyline ProblemHard
Swift217Contains DuplicateEasy
Swift216Combination Sum IIIMedium
Swift215Kth Largest Element in an ArrayMedium
214Shortest PalindromeHard
Swift213House Robber IIMedium
Swift212Word Search IIHard
Swift211Add and Search Word - Data structure designMedium
Swift210Course Schedule IIMedium
Swift209Minimum Size Subarray SumMedium
Swift208Implement Trie (Prefix Tree)Medium
Swift207Course ScheduleMedium
Swift206Reverse Linked ListEasy
Swift205Isomorphic StringsEasy
Swift204Count PrimesEasy
Swift203Remove Linked List ElementsEasy
Swift202Happy NumberEasy
201Bitwise AND of Numbers RangeMedium
Swift200Number of IslandsMedium
Swift199Binary Tree Right Side ViewMedium
Swift198House RobberEasy
191Number of 1 BitsEasy
190Reverse BitsEasy
Swift189Rotate ArrayEasy
Swift188Best Time to Buy and Sell Stock IVHard
187Repeated DNA SequencesMedium
Swift186Reverse Words in a String IIMedium
Swift179Largest NumberMedium
174Dungeon GameHard
Swift173Binary Search Tree IteratorMedium
Swift172Factorial Trailing ZeroesEasy
Swift171Excel Sheet Column NumberEasy
Swift170Two Sum III - Data structure designEasy
Swift169Majority ElementEasy
168Excel Sheet Column TitleEasy
Swift167Two Sum II - Input array is sortedMedium
Swift166Fraction to Recurring DecimalMedium
165Compare Version NumbersEasy
164Maximum GapHard
Swift163Missing RangesMedium
Swift162Find Peak ElementMedium
Swift161One Edit DistanceMedium
160Intersection of Two Linked ListsEasy
Swift159Longest Substring with At Most Two Distinct CharactersHard
158Read N Characters Given Read4 II - Call multiple timesHard
157Read N Characters Given Read4Easy
Swift156Binary Tree Upside DownMedium
Swift155Min StackEasy
Swift154Find Minimum in Rotated Sorted Array IIHard
Swift153Find Minimum in Rotated Sorted ArrayMedium
Swift152Maximum Product SubarrayMedium
Swift151Reverse Words in a StringMedium
Swift150Evaluate Reverse Polish NotationMedium
149Max Points on a LineHard
148Sort ListMedium
147Insertion Sort ListMedium
Swift146LRU CacheHard
Swift145Binary Tree Postorder TraversalHard
Swift144Binary Tree Preorder TraversalMedium
Swift143Reorder ListMedium
142Linked List Cycle IIMedium
141Linked List CycleEasy
140Word Break IIHard
139Word BreakMedium
138Copy List with Random PointerHard
Swift137Single Number IIMedium
Swift136Single NumberMedium
135CandyHard
Swift134Gas StationMedium
133Clone GraphMedium
132Palindrome Partitioning IIHard
Swift131Palindrome PartitioningMedium
130Surrounded RegionsMedium
129Sum Root to Leaf NumbersMedium
Swift128Longest Consecutive SequenceHard
Swift127Word LadderMedium
126Word Ladder IIHard
Swift125Valid PalindromeEasy
Swift124Binary Tree Maximum Path SumHard
Swift123Best Time to Buy and Sell Stock IIIHard
Swift122Best Time to Buy and Sell Stock IIMedium
Swift121Best Time to Buy and Sell StockEasy
Swift120TriangleMedium
119Pascal's Triangle IIEasy
118Pascal's TriangleEasy
117Populating Next Right Pointers in Each Node IIHard
116Populating Next Right Pointers in Each NodeMedium
115Distinct SubsequencesHard
Swift114Flatten Binary Tree to Linked ListMedium
Swift113Path Sum IIMedium
Swift112Path SumEasy
Swift111Minimum Depth of Binary TreeEasy
Swift110Balanced Binary TreeEasy
109Convert Sorted List to Binary Search TreeMedium
Swift108Convert Sorted Array to Binary Search TreeMedium
Swift107Binary Tree Level Order Traversal IIEasy
Swift106Construct Binary Tree from Inorder and Postorder TraversalMedium
Swift105Construct Binary Tree from Preorder and Inorder TraversalMedium
Swift104Maximum Depth of Binary TreeEasy
Swift103Binary Tree Zigzag Level Order TraversalMedium
Swift102Binary Tree Level Order TraversalEasy
Swift101Symmetric TreeEasy
Swift100Same TreeEasy
Swift99Recover Binary Search TreeHard
Swift98Validate Binary Search TreeMedium
97Interleaving StringHard
Swift96Unique Binary Search TreesMedium
95Unique Binary Search Trees IIMedium
Swift94Binary Tree Inorder TraversalMedium
93Restore IP AddressesMedium
92Reverse Linked List IIMedium
Swift91Decode WaysMedium
Swift90Subsets IIMedium
Swift89Gray CodeMedium
Swift88Merge Sorted ArrayEasy
87Scramble StringHard
Swift86Partition ListMedium
85Maximal RectangleHard
84Largest Rectangle in HistogramHard
Swift83Remove Duplicates from Sorted ListEasy
Swift82Remove Duplicates from Sorted List IIMedium
Swift81Search in Rotated Sorted Array IIMedium
Swift80Remove Duplicates from Sorted Array IIMedium
Swift79Word SearchMedium
Swfit78SubsetsMedium
Swift77CombinationsMedium
Swift76Minimum Window SubstringHard
Swift75Sort ColorsMedium
Swift74Search a 2D MatrixMedium
Swift73Set Matrix ZeroesMedium
Swift72Edit DistanceHard
Swift71Simplify PathMedium
Swift70Climbing StairsEasy
Swift69Sqrt(x)Medium
Swift68Text JustificationHard
Swift67Add BinaryEasy
Swift66Plus OneEasy
Swift65Valid NumberHard
Swift64Minimum Path SumMedium
Swift63Unique Paths IIMedium
Swift62Unique PathsMedium
Swift61Rotate ListMedium
Swift60Permutation SequenceMedium
Swift59Spiral Matrix IIMedium
Swift58Length of Last WordEasy
Swift57Insert IntervalHard
Swift56Merge IntervalsHard
Swift55Jump GameMedium
Swift54Spiral MatrixMedium
Swift53Maximum SubarrayMedium
Swift52N-Queens IIHard
Swift51N-QueensHard
Swift50"Pow(x, n)"Medium
Swift49Group AnagramsMedium
Swift48Rotate ImageMedium
Swift47Permutations IIMedium
Swift46PermutationsMedium
45Jump Game IIHard
Swift44Wildcard MatchingHard
Swift43Multiply StringsMedium
Swift42Trapping Rain WaterHard
Swift41First Missing PositiveHard
Swift40Combination Sum IIMedium
Swift39Combination SumMedium
Swift38Count and SayEasy
Swift37Sudoku SolverHard
Swift36Valid SudokuEasy
Swift35Search Insert PositionMedium
Swift34Search for a RangeMedium
Swift33Search in Rotated Sorted ArrayHard
Swift32Longest Valid ParenthesesHard
Swift31Next PermutationMedium
30Substring with Concatenation of All WordsHard
Swift29Divide Two IntegersMedium
Swift28Implement strStr()Easy
Swfit27Remove ElementEasy
Swift26Remove Duplicates from Sorted ArrayEasy
Swift25Reverse Nodes in k-GroupHard
Swift24Swap Nodes in PairsEasy
Swift23Merge k Sorted ListsHard
Swift22Generate ParenthesesMedium
Swift21Merge Two Sorted ListsEasy
Swift20Valid ParenthesesEasy
Swift19Remove Nth Node From End of ListEasy
Swift184SumMedium
Swift17Letter Combinations of a Phone NumberMedium
Swift163Sum ClosestMedium
Swift153SumMedium
Swift14Longest Common PrefixEasy
Swift13Roman to IntegerEasy
Swift12Integer to RomanMedium
Swift11Container With Most WaterMedium
Swift10Regular Expression MatchingHard
Swift9Palindrome NumberEasy
Swift8String to Integer (atoi)Easy
Swift7Reverse IntegerEasy
Swift6ZigZag ConversionEasy
Swift5Longest Palindromic SubstringMedium
Swift4Median of Two Sorted ArraysHard
Swift3Longest Substring Without Repeating CharactersMedium
Swift2Add Two NumbersMedium
Swift1Two SumEasy