LeetCode_Swift alternatives and similar libraries
Based on the "Data Structures" category.
Alternatively, view LeetCode_Swift alternatives based on common mentions on social networks and blogs.
-
swift-algorithm-club
Algorithms and data structures in Swift, with explanations! -
Algorithm
Algorithm is a library of tools that is used to create intelligent applications. -
SwiftLCS
Swift implementation of the longest common subsequence (LCS) algorithm. -
ISParseBind
Setup your class structure in Xcode Interface Builder and save() in Parse Server.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of LeetCode_Swift or a related project?
README
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](./logo.png?style=centerme)
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
Data Structures
- Array
- String
- Linked List
- Stack
- Queue
- Tree
- Dynamic programming
- Depth-first search
- Breadth-first search
- Math
- Search
- Sort
- Graph
- Design
Companies
Array
Title | Solution | Difficulty | Time | Space |
---|---|---|---|---|
Verify an Alien Dictionary | [Swift](Array/VerifyingAlienDictionary.swift) | Easy | O(n) | O(n) |
Sort Array By Parity | [Swift](Array/SortArrayByParity.swift) | Easy | O(n) | O(n) |
Max Consecutive Ones | [Swift](./Array/MaxConsecutiveOnes.swift) | Easy | O(n) | O(1) |
Heaters | [Swift](./Array/Heaters.swift) | Easy | O(nlogn) | O(1) |
Number of Boomerangs | [Swift](./Array/NumberBoomerangs.swift) | Easy | O(n ^ 2) | O(n) |
Island Perimeter | [Swift](./Array/IslandPerimeter.swift) | Easy | O(nm) | O(1) |
Majority Element | [Swift](./Array/MajorityElement.swift) | Easy | O(n) | O(1) |
Majority Element II | [Swift](./Array/MajorityElementII.swift) | Medium | O(n) | O(1) |
First Missing Positive | [Swift](./Array/FirstMissingPositive.swift) | Hard | O(n) | O(n) |
Intersection of Two Arrays | [Swift](./Array/IntersectionTwoArrays.swift) | Easy | O(n) | O(n) |
Intersection of Two Arrays II | [Swift](./Array/IntersectionTwoArraysII.swift) | Easy | O(n) | O(n) |
Contains Duplicate | [Swift](./Array/ContainsDuplicate.swift) | Easy | O(n) | O(n) |
Contains Duplicate II | [Swift](./Array/ContainsDuplicateII.swift) | Easy | O(n) | O(n) |
Remove Duplicates from Sorted Array | [Swift](./Array/RemoveDuplicatesFromSortedArray.swift) | Easy | O(n) | O(1) |
Remove Duplicates from Sorted Array II | [Swift](./Array/RemoveDuplicatesFromSortedArrayII.swift) | Medium | O(n) | O(1) |
Move Zeroes | [Swift](./Array/MoveZeroes.swift) | Easy | O(n) | O(1) |
Remove Element | [Swift](./Array/RemoveElement.swift) | Easy | O(n) | O(1) |
Strobogrammatic Number | [Swift](./Array/StrobogrammaticNumber.swift) | Easy | O(n) | O(1) |
Can Place Flowers | [Swift](./Array/CanPlaceFlowers.swift) | Easy | O(n) | O(1) |
Two Sum | [Swift](./Array/TwoSum.swift) | Easy | O(n) | O(n) |
Two Sum II - Input array is sorted | [Swift](./Array/TwoSumII.swift) | Easy | O(n) | O(1) |
Two Sum III - Data structure design | [Swift](./Array/TwoSumIII.swift) | Easy | O(n) | O(1) |
Two Sum Less Than K | [Swift](./Array/TwoSumLessThanK.swift) | Easy | O(nlogn) | O(n) |
3Sum | [Swift](./Array/ThreeSum.swift) | Medium | O(n2) | O(nC3) |
3Sum Closest | [Swift](./Array/ThreeSumClosest.swift) | Medium | O(n2) | O(nC3) |
4Sum | [Swift](./Array/FourSum.swift) | Medium | O(n3) | O(nC4) |
Increasing Triplet Subsequence | [Swift](./Array/IncreasingTripletSubsequence.swift) | Medium | O(n) | O(1) |
Summary Ranges | [Swift](./Array/SummaryRanges.swift) | Medium | O(n) | O(n) |
Range Sum Query 2D - Immutable | [Swift](./Array/NumMatrix.swift) | Medium | O(mn) | O(mn) |
Missing Ranges | [Swift](./Array/MissingRanges.swift) | Medium | O(n) | O(1) |
Asteroid Collision | [Swift](./Array/AsteroidCollision.swift) | Medium | O(n) | O(n) |
Maximize Distance to Closest Person | [Swift](./Array/MaximizeDistanceToClosestPerson.swift) | Easy | O(n) | O(1) |
Exam Room | [Swift](./Array/ExamRoom.swift) | Medium | O(n) | O(n) |
Shortest Word Distance | [Swift](./Array/ShortestWordDistance.swift) | Easy | O(n) | O(1) |
Shortest Word Distance II | [Swift](./Array/ShortestWordDistanceII.swift) | Medium | O(n) | O(n) |
Shortest Word Distance III | [Swift](./Array/ShortestWordDistanceIII.swift) | Medium | O(n) | O(1) |
Minimum Size Subarray Sum | [Swift](./Array/MinimumSizeSubarraySum.swift) | Medium | O(n) | O(1) |
Maximum Size Subarray Sum Equals k | [Swift](./Array/MaximumSizeSubarraySumEqualsK.swift) | Medium | O(n) | O(n) |
Smallest Range | [Swift](./Array/SmallestRange.swift) | Hard | O(nm) | O(nm) |
Product of Array Except Self | [Swift](./Array/ProductExceptSelf.swift) | Medium | O(n) | O(1) |
Rotate Array | [Swift](./Array/RotateArray.swift) | Easy | O(n) | O(1) |
Rotate Image | [Swift](./Array/RotateImage.swift) | Medium | O(n2) | O(1) |
Spiral Matrix | [Swift](./Array/SpiralMatrix.swift) | Medium | O(n2) | O(1) |
Spiral Matrix II | [Swift](./Array/SpiralMatrixII.swift) | Medium | O(n2) | O(1) |
Diagonal Traverse | [Swift](./Array/DiagonalTraverse.swift) | Medium | O(mn) | O(1) |
Valid Sudoku | [Swift](./Array/ValidSudoku.swift) | Easy | O(n2) | O(n) |
Set Matrix Zero | [Swift](./Array/SetMatrixZeroes.swift) | Medium | O(n2) | O(1) |
Next Permutation | [Swift](./Array/NextPermutation.swift) | Medium | O(n) | O(1) |
Gas Station | [Swift](./Array/GasStation.swift) | Medium | O(n) | O(1) |
Game of Life | [Swift](./Array/GameLife.swift) | Medium | O(n) | O(1) |
Task Scheduler | [Swift](./Array/TaskScheduler.swift) | Medium | O(nlogn) | O(n) |
Validate IP Address | [Swift](./Array/ValidateIPAddress.swift) | Medium | O(n) | O(1) |
Sliding Window Maximum | [Swift](./Array/SlidingWindowMaximum.swift) | Hard | O(n) | O(n) |
Longest Consecutive Sequence | [Swift](./Array/LongestConsecutiveSequence.swift) | Hard | O(n) | O(n) |
Create Maximum Number | [Swift](./Array/CreateMaximumNumber.swift) | Hard | O(n2) | O(n) |
Find All Numbers Disappeared in an Array | [Swift](./Array/FindDisappearedNumbers.swift) | Easy | O(n) | O(1) |
String
Title | Solution | Difficulty | Time | Space |
---|---|---|---|---|
Fizz Buzz | [Swift](./String/FizzBuzz.swift) | Easy | O(n) | O(1) |
First Unique Character in a String | [Swift](./String/FirstUniqueCharacterInString.swift) | Easy | O(n) | O(1) |
Keyboard Row | [Swift](./String/KeyboardRow.swift) | Easy | O(nm) | O(n) |
Valid Word Abbreviation | [Swift](./String/ValidWordAbbreviation.swift) | Easy | O(n) | O(n) |
Valid Palindrome | [Swift](./String/ValidPalindrome.swift) | Easy | O(n) | O(n) |
Valid Palindrome II | [Swift](./String/ValidPalindromeII.swift) | Easy | O(n) | O(n) |
Detect Capital | [Swift](./String/DetectCapital.swift) | Easy | O(n) | O(1) |
Count and Say | [Swift](./String/CountAndSay.swift) | Easy | O(n2) | O(1) |
Flip Game | [Swift](./String/FlipGame.swift) | Easy | O(n) | O(n) |
Implement strStr() | [Swift](./String/StrStr.swift) | Easy | O(nm) | O(n) |
Isomorphic Strings | [Swift](./String/IsomorphicStrings.swift) | Easy | O(n) | O(n) |
Reverse String | [Swift](./String/ReverseString.swift) | Easy | O(n) | O(n) |
Reverse String II | [Swift](./String/ReverseStringII.swift) | Easy | O(n) | O(n) |
Reverse Vowels of a String | [Swift](./String/ReverseVowelsOfAString.swift) | Easy | O(n) | O(n) |
Reverse Words in a String | [Swift](./String/ReverseWordsString.swift) | Medium | O(n) | O(1) |
Reverse Words in a String II | [Swift](./String/ReverseWordsStringII.swift) | Medium | O(n) | O(1) |
Reverse Words in a String III | [Swift](./String/ReverseWordsStringIII.swift) | Easy | O(n) | O(1) |
Length of Last Word | [Swift](./String/AddStrings.swift) | Easy | O(n) | O(n) |
String Compression | [Swift](./String/StringCompression.swift) | Easy | O(n) | O(1) |
Add Strings | [Swift](./String/LengthLastWord.swift) | Easy | O(n) | O(1) |
Shortest Distance to a Character | [Swift](./String/ShortestDistanceToACharacter.swift) | Easy | O(n) | O(1) |
Multiply Strings | [Swift](./String/MultiplyStrings.swift) | Medium | O(n) | O(1) |
Palindrome Permutation | [Swift](./String/PalindromePermutation.swift) | Easy | O(n) | O(n) |
Valid Anagram | [Swift](./String/ValidAnagram.swift) | Easy | O(n) | O(n) |
Ransom Note | [Swift](./String/RansomNote.swift) | Easy | O(n) | O(n) |
Group Anagrams | [Swift](./String/GroupAnagrams.swift) | Medium | O(nmlogm + nlogn) | O(n) |
Find Duplicate File in System | [Swift](./String/FindDuplicateFileInSystem.swift) | Medium | O(nm) | O(n) |
Longest Common Prefix | [Swift](./String/LongestCommonPrefix.swift) | Easy | O(nm) | O(m) |
Longest Substring Without Repeating Characters | [Swift](./String/LongestSubstringWithoutRepeatingCharacters.swift) | Medium | O(n) | O(n) |
One Edit Distance | [Swift](./String/OneEditDistance.swift) | Medium | O(n) | O(n) |
Word Pattern | [Swift](./String/WordPattern.swift) | Easy | O(n) | O(n) |
Permutation in String | [Swift](/.String/PermutationInString.swift) | Medium | O(nm) | O(n) |
Find All Anagrams in a String | [Swift](/.String/FindAllAnagramsInAString.swift) | Medium | O(n) | O(n) |
Minimum Window Substring | [Swift](./String/MinimumWindowSubstring.swift) | Hard | O(n2) | O(n) |
Longest Substring with At Most Two Distinct Characters | [Swift](./String/LongestSubstringMostTwoDistinctCharacters.swift) | Hard | O(n) | O(n) |
Longest Substring with At Most K Distinct Characters | [Swift](./String/LongestSubstringMostKDistinctCharacters.swift) | Hard | O(n) | O(n) |
Text Justification | [Swift](./String/TextJustification.swift) | Hard | O(n) | O(n) |
Find the Closest Palindrome | [Swift](./String/FindClosestPalindrome.swift) | Hard | O(n) | O(n) |
Linked List
Title | Solution | Difficulty | Time | Space |
---|---|---|---|---|
Reverse Linked List | [Swift](./LinkedList/ReverseLinkedList.swift) | Easy | O(n) | O(1) |
Palindrome Linked List | [Swift](./LinkedList/PalindromeLinkedList.swift) | Easy | O(n) | O(1) |
Swap Nodes in Pairs | [Swift](./LinkedList/SwapNodesInPairs.swift) | Easy | O(n) | O(1) |
Remove Linked List Elements | [Swift](./LinkedList/RemoveLinkedListElements.swift) | Easy | O(n) | O(1) |
Remove Duplicates from Sorted List | [Swift](./LinkedList/RemoveDuplicatesFromSortedList.swift) | Easy | O(n) | O(1) |
Remove Duplicates from Sorted List II | [Swift](./LinkedList/RemoveDuplicatesFromSortedListII.swift) | Medium | O(n) | O(1) |
Remove Nth Node From End of List | [Swift](./LinkedList/RemoveNthFromEnd.swift) | Easy | O(n) | O(1) |
Odd Even Linked List | [Swift](./LinkedList/OddEvenLinkedList.swift) | Medium | O(n) | O(1) |
Rotate List | [Swift](./LinkedList/RotateList.swift) | Medium | O(n) | O(1) |
Reorder List | [Swift](./LinkedList/ReorderList.swift) | Medium | O(n) | O(1) |
Merge Two Sorted Lists | [Swift](./LinkedList/MergeTwoSortedLists.swift) | Easy | O(n) | O(1) |
Merge k Sorted Lists | [Swift](./LinkedList/MergeKSortedLists.swift) | Hard | O(mlogn) | O(1) |
Partition List | [Swift](./LinkedList/PartitionList.swift) | Medium | O(n) | O(1) |
Reverse Nodes in k-Group | [Swift](./LinkedList/ReverseNodesInKGroup.swift) | Hard | O(n) | O(1) |
LRU Cache | [Swift](./LinkedList/LRUCache.swift) | Hard | O(1) | O(1) |
LFU Cache | [Swift](./LinkedList/LFUCache.swift) | Hard | O(1) | O(1) |
Stack
Title | Solution | Difficulty | Time | Space |
---|---|---|---|---|
Min Stack | [Swift](./Stack/MinStack.swift) | Easy | O(1) | O(n) |
Max Stack | [Swift](./Stack/MaxStack.swift) | Easy | O(n) | O(n) |
Valid Parentheses | [Swift](./Stack/ValidParentheses.swift) | Easy | O(n) | O(n) |
Longest Valid Parentheses | [Swift](./Stack/LongestValidParentheses.swift) | Hard | O(n) | O(n) |
Evaluate Reverse Polish Notation | [Swift](./Stack/EvaluateReversePolishNotation.swift) | Medium | O(n) | O(n) |
Exclusive Time of Functions | [Swift](./Stack/ExclusiveTimeFunctions.swift) | Medium | O(n) | O(n) |
Simplify Path | [Swift](./Stack/SimplifyPath.swift) | Medium | O(n) | O(n) |
Remove K Digits | [Swift](./Stack/RemoveKDigits.swift) | Medium | O(n) | O(n) |
Ternary Expression Parser | [Swift](./Stack/TernaryExpressionParser.swift) | Medium | O(n) | O(n) |
Binary Tree Preorder Traversal | [Swift](./Stack/PreorderTraversal.swift) | Medium | O(n) | O(n) |
Binary Tree Inorder Traversal | [Swift](./Stack/InorderTraversal.swift) | Medium | O(n) | O(n) |
Binary Search Tree Iterator | [Swift](./Stack/BinarySearchTreeIterator.swift) | Medium | O(n) | O(n) |
Binary Tree Postorder Traversal | [Swift](./Stack/PostorderTraversal.swift) | Hard | O(n) | O(n) |
Decode String | [Swift](./Stack/DecodeString.swift) | Medium | O(n) | O(n) |
Basic Calculator | [Swift](./Stack/BasicCalculator.swift) | Hard | O(n) | O(n) |
Queue
Title | Solution | Difficulty | Time | Space |
---|---|---|---|---|
Implement Queue using Stacks | [Swift](./Queue/ImplementQueueUsingStacks.swift) | Easy | O(n) | O(n) |
Tree
Title | Solution | Difficulty | Time | Space |
---|---|---|---|---|
Same Tree | [Swift](./Tree/SameTree.swift) | Easy | O(n) | O(n) |
Symmetric Tree | [Swift](./Tree/SymmetricTree.swift) | Easy | O(n) | O(n) |
Invert Binary Tree | [Swift](./Tree/InvertBinaryTree.swift) | Easy | O(n) | O(n) |
Binary Tree Upside Down | [Swift](./Tree/BinaryTreeUpsideDown.swift) | Medium | O(n) | O(1) |
Minimum Depth of Binary Tree | [Swift](./Tree/MinimumDepthOfBinaryTree.swift) | Easy | O(n) | O(1) |
Maximum Depth of Binary Tree | [Swift](./Tree/MaximumDepthOfBinaryTree.swift) | Easy | O(n) | O(1) |
Diameter of Binary Tree | [Swift](./Tree/DiameterBinaryTree.swift) | Easy | O(n) | O(1) |
Balanced Binary Tree | [Swift](./Tree/BalancedBinaryTree.swift) | Easy | O(n) | O(n) |
Sum of Left Leaves | [Swift](./Tree/SumLeftLeaves.swift) | Easy | O(n) | O(1) |
Flatten Binary Tree to Linked List | [Swift](./Tree/FlattenBinaryTreeLinkedList.swift) | Medium | O(n) | O(1) |
Convert Sorted Array to Binary Search Tree | [Swift](./Tree/ConvertSortedArrayBinarySearchTree.swift) | Easy | O(n) | O(1) |
Validate Binary Search Tree | [Swift](./Tree/ValidateBinarySearchTree.swift) | Medium | O(n) | O(log n) |
Binary Tree Level Order Traversal | [Swift](./Tree/BinaryTreeLevelOrderTraversal.swift) | Easy | O(n) | O(n) |
Binary Tree Level Order Traversal II | [Swift](./Tree/BinaryTreeLevelOrderTraversalII.swift) | Easy | O(n) | O(n) |
Merge Two Binary Trees | [Swift](./Tree/MergeTwoBinaryTrees.swift) | Easy | O(n) | O(n) |
Binary Tree Zigzag Level Order Traversal | [Swift](./Tree/BinaryTreeZigzagLevelOrderTraversal.swift) | Medium | O(n) | O(n) |
Binary Tree Vertical Order Traversal | [Swift](./Tree/BinaryTreeVerticalOrderTraversal.swift) | Medium | O(n) | O(n) |
Kth Smallest Element in a BST | [Swift](./Tree/KthSmallestElementBST.swift) | Medium | O(n) | O(n) |
Binary Tree Right Side View | [Swift](./Tree/BinaryTreeRightSideView.swift) | Medium | O(n) | O(n) |
Construct Binary Tree from Preorder and Inorder Traversal | [Swift](./Tree/ConstructBinaryTreePreorderInorder.swift) | Medium | O(nlogn) | O(1) |
Construct Binary Tree from Inorder and Postorder Traversal | [Swift](./Tree/ConstructBinaryTreeInorderPostorder.swift) | Medium | O(nlogn) | O(1) |
Path Sum | [Swift](./Tree/PathSum.swift) | Easy | O(n) | O(n) |
Path Sum II | [Swift](./Tree/PathSumII.swift) | Medium | O(n) | O(n) |
Path Sum III | [Swift](./Tree/PathSumIII.swift) | Easy | O(n2) | O(1) |
Binary Tree Paths | [Swift](./Tree/BinaryTreePaths.swift) | Easy | O(n) | O(n) |
Binary Tree Maximum Path Sum | [Swift](./Tree/BinaryTreeMaximumPathSum.swift) | Hard | O(n) | O(1) |
House Robber III | [Swift](./Tree/HouseRobberIII.swift) | Medium | O(n) | O(1) |
Unique Binary Search Trees | [Swift](./Tree/UniqueBinarySearchTrees.swift) | Medium | O(n2) | O(n) |
Recover Binary Search Tree | [Swift](./Tree/RecoverBinarySearchTree.swift) | Hard | O(n) | O(1) |
Serialize and Deserialize Binary Tree | [Swift](./Tree/SerializeDeserializeBinaryTree.swift) | Hard | O(n) | O(n) |
Serialize and Deserialize N-ary Tree | [Swift](./Tree/SerializeDeserializeNAryTree.swift) | Hard | O(n) | O(n) |
Dynamic programming
Title | Solution | Difficulty | Time | Space |
---|---|---|---|---|
Nested List Weight Sum | [Swift](./DP/NestedListWeightSum.swift) | Easy | O(n) | O(1) |
Climbing Stairs | [Swift](./DP/ClimbingStairs.swift) | Easy | O(n) | O(1) |
Min Cost Climbing Stairs | [Swift](./DP/MinCostClimbingStairs.swift) | Easy | O(n) | O(n) |
Unique Paths | [Swift](./DP/UniquePaths.swift) | Medium | O(mn) | O(mn) |
Unique Paths II | [Swift](./DP/UniquePathsII.swift) | Medium | O(mn) | O(mn) |
Nested List Weight Sum II | [Swift](./DP/NestedListWeightSumII.swift) | Medium | O(n) | O(n) |
Flip Game II | [Swift](./DP/FlipGameII.swift) | Medium | O(n) | O(n) |
Can I Win | [Swift](./DP/CanIWin.swift) | Medium | O(2n) | O(n) |
Decode Ways | [Swift](./DP/DecodeWays.swift) | Medium | O(n) | O(n) |
Minimum Path Sum | [Swift](./DP/MinimumPathSum.swift) | Medium | O(mn) | O(mn) |
Generate Parentheses | [Swift](./DP/GenerateParentheses.swift) | Medium | O(2n) | O(n) |
Different Ways to Add Parentheses | [Swift](./DP/DifferentWaysAddParentheses.swift) | Medium | O(nn) | O(n) |
Best Time to Buy and Sell Stock | [Swift](./DP/BestTimeBuySellStock.swift) | Easy | O(n) | O(1) |
Best Time to Buy and Sell Stock II | [Swift](./DP/BestTimeBuySellStockII.swift) | Medium | O(n) | O(1) |
Best Time to Buy and Sell Stock III | [Swift](./DP/BestTimeBuySellStockIII.swift) | Hard | O(n) | O(n) |
Best Time to Buy and Sell Stock IV | [Swift](./DP/BestTimeBuySellStockIV.swift) | Hard | O(n2) | O(n) |
Best Time to Buy and Sell Stock with Cooldown | [Swift](./DP/BestTimeBuySellStockCooldown.swift) | Medium | O(n2) | O(n) |
Maximum Sum of 3 Non-Overlapping Subarrays | [Swift](./DP/MaximumSumThreeNonOverlappingSubarrays.swift) | Hard | O(n) | O(n) |
Coin Change | [Swift](./DP/CoinChange.swift) | Medium | O(n2) | O(n) |
Coin Change II | [Swift](./DP/CoinChangeII.swift) | Medium | O(n2) | O(n) |
Paint House | [Swift](./DP/PaintHouse.swift) | Easy | O(n) | O(n) |
Paint House II | [Swift](./DP/PaintHouseII.swift) | Hard | O(n) | O(1) |
Longest Increasing Subsequence | [Swift](./DP/LongestIncreasingSubsequence.swift) | Medium | O(nlogn) | O(n) |
Longest Common Subsequence | [Swift](./DP/LongestCommonSubsequence.swift) | Medium | O(mn) | O(1) |
Palindromic Substrings | [Swift](./DP/PalindromicSubstrings.swift) | Medium | O(n2) | O(n2) |
Longest Palindromic Substring | [Swift](./DP/LongestPalindromicSubstring.swift) | Medium | O(n2) | O(n2) |
Perfect Squares | [Swift](./DP/PerfectSquares.swift) | Medium | O(n2) | O(n) |
House Robber | [Swift](./DP/HouseRobber.swift) | Easy | O(n) | O(1) |
House Robber II | [Swift](./DP/HouseRobberII.swift) | Medium | O(n) | O(1) |
Paint Fence | [Swift](./DP/PaintFence.swift) | Easy | O(n) | O(n) |
Maximum Subarray | [Swift](./DP/MaximumSubarray.swift) | Medium | O(n) | O(1) |
Maximum Product Subarray | [Swift](./DP/MaximumProductSubarray.swift) | Medium | O(n) | O(1) |
Maximum Number of Points with Cost | [Swift](./DP/MaximumNumberPointsCost.swift) | Medium | O(mn) | O(1) |
Maximal Square | [Swift](./DP/MaximalSquare.swift) | Medium | O(mn) | O(mn) |
Edit Distance | [Swift](./DP/EditDistance.swift) | Hard | O(mn) | O(mn) |
Combination Sum IV | [Swift](./DP/CombinationSumIV.swift) | Medium | O(2n) | O(n) |
Triangle | [Swift](./DP/Triangle.swift) | Medium | O(2n) | O(m) |
Wiggle Subsequence | [Swift](./DP/WiggleSubsequence.swift) | Medium | O(n) | O(1) |
Wildcard Matching | [Swift](./DP/WildcardMatching.swift) | Hard | O(mn) | O(mn) |
Regular Expression Matching | [Swift](./DP/RegularExpressionMatching.swift) | Hard | O(mn) | O(mn) |
Minimum Window Subsequence | [Swift](./DP/MinimumWindowSubsequence.swift) | Hard | O(mn) | O(mn) |
Guess Number Higher or Lower II | [Swift](./DP/GuessNumberHigherOrLowerII.swift) | Medium | O(nlogn) | O(n2) |
Burst Ballons | [Swift](./DP/BurstBalloons.swift) | Hard | O(n3) | O(n) |
Frog Jump | [Swift](./DP/FrogJump.swift) | Hard | O(n2) | O(n) |
Jump Game | [Swift](./DP/JumpGame.swift) | Medium | O(n) | O(1) |
Dungeon Game | [Swift](./DP/DungeonGame.swift) | Hard | O(nm) | O(nm) |
Depth-first search
Title | Solution | Difficulty | Time | Space |
---|---|---|---|---|
Permutations | [Swift](./DFS/Permutations.swift) | Medium | O(2n) | O(n) |
Permutations II | [Swift](./DFS/PermutationsII.swift) | Medium | O(2n) | O(n) |
Subsets | [Swift](./DFS/Subsets.swift) | Medium | O(nn) | O(n) |
Subsets II | [Swift](./DFS/SubsetsII.swift) | Medium | O(2n) | O(n) |
Combinations | [Swift](./DFS/Combinations.swift) | Medium | O(2n) | O(n) |
Combination Sum | [Swift](./DFS/CombinationSum.swift) | Medium | O(2n) | O(n) |
Combination Sum II | [Swift](./DFS/CombinationSumII.swift) | Medium | O(2n) | O(n) |
Combination Sum III | [Swift](./DFS/CombinationSumIII.swift) | Medium | O(2n) | O(n) |
Letter Combinations of a Phone Number | [Swift](./DFS/LetterCombinationsPhoneNumber.swift) | Medium | O(4n) | O(n) |
Factor Combinations | [Swift](./DFS/FactorCombinations.swift) | Medium | O(nn)) | O(2n - 1) |
Strobogrammatic Number II | [Swift](./DFS/StrobogrammaticNumberII.swift) | Medium | O(mn) | O(n) |
Generalized Abbreviation | [Swift](./DFS/GeneralizedAbbreviation.swift) | Medium | O(nn) | O(2n) |
Palindrome Partitioning | [Swift](./DFS/PalindromePartitioning.swift) | Medium | O(nn) | O(n) |
Is Graph Bipartite | [Swift](./DFS/IsGraphBipartite.swift) | Medium | O(n) | O(n) |
Number of Islands | [Swift](./DFS/NumberofIslands.swift) | Medium | O((mn)2) | O(1) |
Walls and Gates | [Swift](./DFS/WallsGates.swift) | Medium | O(nn) | O(2n) |
Word Search | [Swift](./DFS/WordSearch.swift) | Medium | O((mn * 4 ^ (k - 1)) | O(mn) |
Word Search II | [Swift](./DFS/WordSearchII.swift) | Hard | O(((mn)2)) | O(n2) |
Add and Search Word - Data structure design | [Swift](./DFS/WordDictionary.swift) | Medium | O(n) | O(n) |
Partition to K Equal Sum Subsets | [Swift](./DFS/PartitionKEqualSumSubsets.swift) | Medium | O(kn) | O(n) |
N-Queens | [Swift](./DFS/NQueens.swift) | Hard | O((nn)) | O(n2) |
N-Queens II | [Swift](./DFS/NQueensII.swift) | Hard | O((nn)) | O(n) |
Word Squares | [Swift](./DFS/WordSquares.swift) | Hard | O((n2)) | O(n2) |
Word Pattern II | [Swift](./DFS/WordPatternII.swift) | Hard | O(nn) | O(n) |
Sudoku Solver | [Swift](./DFS/SudokuSolver.swift) | Hard | O(n4) | O(1) |
Remove Invalid Parentheses | [Swift](./DFS/RemoveInvalidParentheses.swift) | Hard | O(nn) | O(n) |
Expression Add Operators | [Swift](./DFS/ExpressionAddOperators.swift) | Hard | O(nn) | O(n) |
Breadth-first search
Title | Solution | Difficulty | Time | Space |
---|---|---|---|---|
Word Ladder | [Swift](./BFS/WordLadder.swift) | Medium | O(nm) | O(nm) |
Evaluate Division | [Swift](./BFS/EvaluateDivision.swift) | Medium | O(n2) | O(n) |
Shortest Distance from All Buildings | [Swift](./BFS/ShortestDistanceAllBuildings.swift) | Hard | O((mn)2) | O(mn) |
Math
Title | Solution | Difficulty | Time | Space |
---|---|---|---|---|
Add Binary | [Swift](./Math/AddBinary.swift) | Easy | O(n) | O(n) |
Add Two Numbers | [Swift](./Math/AddTwoNumbers.swift) | Medium | O(n) | O(1) |
Add Digits | [Swift](./Math/AddDigits.swift) | Easy | O(1) | O(1) |
Plus One | [Swift](./Math/PlusOne.swift) | Easy | O(n) | O(1) |
Missing Number | [Swift](./Math/MissingNumber.swift) | Easy | O(n) | O(1) |
Divide Two Integers | [Swift](./Math/DivideTwoIntegers.swift) | Medium | O(logn) | O(1) |
Number Complement | [Swift](./Math/NumberComplement.swift) | Easy | O(n) | O(1) |
Hamming Distance | [Swift](./Math/HammingDistance.swift) | Easy | O(n) | O(1) |
Integer Break | [Swift](./Math/IntegerBreak.swift) | Medium | O(logn) | O(1) |
Factorial Trailing Zeroes | [Swift](./Math/FactorialTrailingZeroes.swift) | Medium | O(logn) | O(1) |
Happy Number | [Swift](./Math/HappyNumber.swift) | Easy | O(n) | O(n) |
Single Number | [Swift](./Math/SingleNumber.swift) | Medium | O(n) | O(1) |
Ugly Number | [Swift](./Math/UglyNumber.swift) | Easy | O(logn) | O(1) |
Ugly Number II | [Swift](./Math/UglyNumberII.swift) | Medium | O(n) | O(n) |
Super Ugly Number | [Swift](./Math/SuperUglyNumber.swift) | Medium | O(n2) | O(n) |
Count Primes | [Swift](./Math/CountPrimes.swift) | Easy | O(n) | O(n) |
String to Integer (atoi) | [Swift](./Math/Atoi.swift) | Easy | O(n) | O(1) |
Fraction to Recurring Decimal | [Swift](./Math/FractionToRecurringDecimal.swift) | Medium | O(logn) | O(n) |
Pow(x, n) | [Swift](./Math/Pow.swift) | Medium | O(logn) | O(1) |
Power of Two | [Swift](./Math/PowerTwo.swift) | Easy | O(1) | O(1) |
Power of Three | [Swift](./Math/PowerThree.swift) | Easy | O(1) | O(1) |
Super Power | [Swift](./Math/SuperPow.swift) | Medium | O(n) | O(1) |
Sum of Two Integers | [Swift](./Math/SumTwoIntegers.swift) | Easy | O(n) | O(1) |
Reverse Integer | [Swift](./Math/ReverseInteger.swift) | Easy | O(n) | O(1) |
Excel Sheet Column Number | [Swift](./Math/ExcelSheetColumnNumber.swift) | Easy | O(n) | O(1) |
Integer to Roman | [Swift](./Math/IntegerToRoman.swift) | Medium | O(n) | O(1) |
Roman to Integer | [Swift](./Math/RomanToInteger.swift) | Easy | O(n) | O(n) |
Integer to English Words | [Swift](./Math/IntegerEnglishWords.swift) | Hard | O(n) | O(1) |
Sparse Matrix Multiplication | [Swift](./Math/SparseMatrixMultiplication.swift) | Medium | O(n3) | O(n2) |
Rectangle Area | [Swift](./Math/RectangleArea.swift) | Easy | O(1) | O(1) |
Minimum Moves to Equal Array Elements | [Swift](./Math/MinimumMovesEqualArrayElements.swift) | Easy | O(n) | O(1) |
Pour Water | [Swift](./Math/TrappingRainWater.swift) | Hard | O(n) | O(n) |
Trapping Rain Water | [Swift](./Math/TrappingRainWater.swift) | Medium | O(nk) | O(1) |
Container With Most Water | [Swift](./Math/ContainerMostWater.swift) | Medium | O(n) | O(1) |
Counting Bits | [Swift](./Math/CountingBits.swift) | Medium | O(n) | O(n) |
K-th Smallest in Lexicographical Order | [Swift](./Math/KthSmallestLexicographicalOrder.swift) | Hard | O(n) | O(1) |
Gary Code | [Swift](./Math/GaryCode.swift) | Medium | O(n) | O(2n) |
Permutation Sequence | [Swift](./Math/PermutationSequence.swift) | Medium | O(n2) | O(1) |
Line Reflection | [Swift](./Math/LineReflection.swift) | Medium | O(n) | O(n) |
Valid Number | [Swift](./Math/ValidNumber.swift) | Hard | O(n) | O(1) |
Search
Title | Solution | Difficulty | Time | Space |
---|---|---|---|---|
Closest Binary Search Tree Value | [Swift](./Search/ClosestBinarySearchTreeValue.swift) | Easy | O(logn) | O(1) |
Closest Binary Search Tree Value II | [Swift](./Search/ClosestBinarySearchTreeValueII.swift) | Hard | O(n) | O(n) |
Search in Rotated Sorted Array | [Swift](./Search/SearchInRotatedSortedArray.swift) | Hard | O(logn) | O(1) |
Search in Rotated Sorted Array II | [Swift](./Search/SearchInRotatedSortedArrayII.swift) | Medium | O(logn) | O(1) |
Find Minimum in Rotated Sorted Array | [Swift](./Search/FindMinimumRotatedSortedArray.swift) | Medium | O(logn) | O(1) |
Find Minimum in Rotated Sorted Array II | [Swift](./Search/FindMinimumRotatedSortedArrayII.swift) | Hard | O(logn) | O(1) |
Search a 2D Matrix | [Swift](./Search/Search2DMatrix.swift) | Medium | O(log(m + n)) | O(1) |
Search a 2D Matrix II | [Swift](./Search/Search2DMatrixII.swift) | Medium | O(m + n) | O(1) |
Search for a Range | [Swift](./Search/SearchForARange.swift) | Medium | O(logn) | O(1) |
Search Insert Position | [Swift](./Search/SearchInsertPosition.swift) | Medium | O(logn) | O(1) |
Peak Index in a Mountain Array | [Swift](./Search/PeakIndexMountainArray.swift) | Easy | O(logn) | O(1) |
Find Peak Element | [Swift](./Search/FindPeakElement.swift) | Medium | O(logn) | O(1) |
Random Pick with Weight | [Swift](./Search/RandomPickWeight.swift) | Medium | O(logn) | O(1) |
Sqrt(x) | [Swift](./Search/Sqrtx.swift) | Medium | O(logn) | O(1) |
Median of Two Sorted Arrays | [Swift](./Search/MedianTwoSortedArrays.swift) | Hard | O(log(m + n)) | O(1) |
Minimize Max Distance to Gas Station | [Swift](./Search/MinimizeMaxDistanceGasStation.swift) | Hard | O(nlogm) | O(1) |
Sort
Title | Solution | Difficulty | Time | Space |
---|---|---|---|---|
Merge Sorted Array | [Swift](./Sort/MergeSortedArray.swift) | Easy | O(n) | O(1) |
Sort Colors | [Swift](./Sort/SortColors.swift) | Medium | O(n) | O(1) |
Wiggle Sort | [Swift](./Sort/WiggleSort.swift) | Medium | O(n) | O(1) |
Wiggle Sort II | [Swift](./Sort/WiggleSortII.swift) | Medium | O(nlogn) | O(n) |
Sort Transformed Array | [Swift](./Sort/SortTransformedArray.swift) | Medium | O(n) | O(1) |
Top K Frequent Elements | [Swift](./Sort/TopKFrequentElements.swift) | Medium | O(nlogn) | O(n) |
Meeting Rooms | [Swift](./Sort/MeetingRooms.swift) | Easy | O(nlogn) | O(1) |
Meeting Rooms II | [Swift](./Sort/MeetingRoomsII.swift) | Medium | O(nlogn) | O(n) |
Merge Intervals | [Swift](./Sort/MergeIntervals.swift) | Hard | O(nlogn) | O(n) |
Alien Dictionary | [Swift](./Graph/AlienDictionary.swift) | Hard | O(nm) | O(nm) |
Kth Largest Element in an Array | [Swift](./Sort/KthLargestElementInArray.swift) | Medium | O(nlogn) | O(n) |
Array Partition I | [Swift](./Sort/ArrayPartitionI.swift) | Easy | O(nlogn) | O(n) |
Insert Interval | [Swift](./Sort/InsertInterval.swift) | Hard | O(n) | O(1) |
Largest Number | [Swift](./Sort/LargestNumber.swift) | Medium | O(nlogn) | O(1) |
Graph
Title | Solution | Difficulty | Time | Space |
---|---|---|---|---|
Number of Connected Components in an Undirected Graph | [Swift](./Graph/NumberConnectedComponentsUndirectedGraph.swift) | Medium | O(nlogn) | O(n) |
Graph Valid Tree | [Swift](./Graph/GraphValidTree.swift) | Medium | O(nlogn) | O(n) |
Number of Islands II | [Swift](./Graph/NumberIslandsII.swift) | Hard | O(klogmn) | O(mn) |
Course Schedule | [Swift](./Graph/CourseSchedule.swift) | Medium | O(n) | O(n) |
Course Schedule II | [Swift](./Graph/CourseScheduleII.swift) | Medium | O(n) | O(n) |
Design
Title | Solution | Difficulty | Time | Space |
---|---|---|---|---|
Shuffle an Array | [Swift](./Design/ShuffleAnArray.swift) | Easy | O(n) | O(1) |
Design HashMap | [Swift](./Design/DesignHashMap.swift) | Easy | O(n) | O(n) |
Design Tic-Tac-Toe | [Swift](./Design/DesignTicTacToe.swift) | Medium | O(1) | O(n) |
Flatten Nested List Iterator | [Swift](./Design/FlattenNestedListIterator.swift) | Medium | O(n) | O(n) |
Flatten 2D Vector | [Swift](./Design/Vector2D.swift) | Medium | O(n) | O(n) |
Implement Trie (Prefix Tree) | [Swift](./Design/ImplementTrie.swift) | Medium | O(n) | O(n) |
Add and Search Word - Data structure design | [Swift](./Design/AddSearchWord.swift) | Medium | O(24n) | O(n) |
Insert Delete GetRandom O(1) | [Swift](./Design/InsertDeleteGetRandom.swift) | Medium | O(1) | O(n) |
LRU Cache | [Swift](./Design/LRUCache.swift) | Hard | O(1) | O(n) |
All O`one Data Structure | [Swift](./Design/AllOne.swift) | Hard | O(1) | O(n) |
Title | Solution | Difficulty | Frequency |
---|---|---|---|
Race Car | [Swift](./BFS/RaceCar.swift) | Hard | โ โ โ โ โ โ |
Plus One | [Swift](./Math/PlusOne.swift) | Easy | โ โ โ โ โ โ |
Number of Islands | [Swift](./DFS/NumberofIslands.swift) | Medium | โ โ โ โ |
Summary Ranges | [Swift](./Array/SummaryRanges.swift) | Medium | โ โ โ โ |
Perfect Squares | [Swift](./DP/PerfectSquares.swift) | Medium | โ โ โ โ |
Merge Intervals | [Swift](./Sort/MergeIntervals.swift) | Hard | โ โ โ |
Valid Parentheses | [Swift](./Stack/ValidParentheses.swift) | Easy | โ โ โ |
Trapping Rain Water | [Swift](./Math/TrappingRainWater.swift) | Hard | โ โ |
Merge k Sorted Lists | [Swift](./LinkedList/MergeKSortedLists.swift) | Hard | โ โ |
Longest Consecutive Sequence | [Swift](./Array/LongestConsecutiveSequence.swift) | Hard | โ โ |
Find Peak Element | [Swift](./Search/FindPeakElement.swift) | Medium | โ โ |
Power of Two | [Swift](./Math/PowerTwo.swift) | Easy | โ โ |
Spiral Matrix | [Swift](./Array/SpiralMatrix.swift) | Medium | โ โ |
Sliding Window Maximum | [Swift](./Array/SlidingWindowMaximum.swift) | Hard | โ โ |
Pow(x, n) | [Swift](./Math/Pow.swift) | Medium | โ โ |
Letter Combinations of a Phone Number | [Swift](./DFS/LetterCombinationsPhoneNumber.swift) | Medium | โ โ |
Heaters | [Swift](./Array/Heaters.swift) | Easy | โ |
Title | Solution | Difficulty | Frequency |
---|---|---|---|
3Sum | [Swift](./Array/ThreeSum.swift) | Medium | โ โ โ โ โ โ |
Valid Palindrome | [Swift](./String/ValidPalindrome.swift) | Easy | โ โ โ โ โ โ |
Valid Palindrome II | [Swift](./String/ValidPalindromeII.swift) | Easy | โ โ โ โ โ โ |
Move Zeroes | [Swift](./Array/MoveZeroes.swift) | Easy | โ โ โ โ โ โ |
Remove Invalid Parentheses | [Swift](./DFS/RemoveInvalidParentheses.swift) | Hard | โ โ โ โ โ โ |
Add Binary | [Swift](./Math/AddBinary.swift) | Easy | โ โ โ โ โ |
Two Sum | [Swift](./Array/TwoSum.swift) | Easy | โ โ โ โ โ |
Binary Tree Paths | [Swift](./Tree/BinaryTreePaths.swift) | Easy | โ โ โ โ |
Letter Combinations of a Phone Number | [Swift](./DFS/LetterCombinationsPhoneNumber.swift) | Medium | โ โ โ โ |
Merge k Sorted Lists | [Swift](./LinkedList/MergeKSortedLists.swift) | Hard | โ โ โ โ |
Reverse Linked List | [Swift](./LinkedList/ReverseLinkedList.swift) | Easy | โ โ โ |
Merge Intervals | [Swift](./Sort/MergeIntervals.swift) | Hard | โ โ โ |
Number of Islands | [Swift](./DFS/NumberofIslands.swift) | Medium | โ โ โ |
Reverse Linked List | [Swift](./LinkedList/ReverseLinkedList.swift) | Easy | โ โ โ |
Expression Add Operators | [Swift](./DFS/ExpressionAddOperators.swift) | Hard | โ โ โ |
Subsets | [Swift](./DFS/Subsets.swift) | Medium | โ โ โ |
Sort Colors | [Swift](./Sort/SortColors.swift) | Medium | โ โ |
Snapchat
Title | Solution | Difficulty | Frequency |
---|---|---|---|
Game of Life | [Swift](./Array/GameLife.swift) | Medium | โ โ โ โ โ โ |
Meeting Rooms II | [Swift](./Sort/MeetingRoomsII.swift) | Medium | โ โ โ โ โ โ |
Valid Sudoku | [Swift](./Array/ValidSudoku.swift) | Easy | โ โ โ โ โ |
Binary Tree Vertical Order Traversal | [Swift](./Tree/BinaryTreeVerticalOrderTraversal.swift) | Medium | โ โ โ โ |
Alien Dictionary | [Swift](./Graph/AlienDictionary.swift) | Hard | โ โ โ โ |
One Edit Distance | [Swift](./String/OneEditDistance.swift) | Medium | โ โ โ |
Sudoku Solver | [Swift](./Math/SudokuSolver.swift) | Hard | โ โ โ |
Reverse Linked List | [Swift](./LinkedList/ReverseLinkedList.swift) | Easy | โ โ |
Unique Binary Search Trees | [Swift](./Tree/UniqueBinarySearchTrees.swift) | Medium | โ โ |
Minimum Window Substring | [Swift](./String/MinimumWindowSubstring.swift) | Hard | โ โ |
Remove K Digits | [Swift](./Stack/RemoveKDigits.swift) | Medium | โ |
Ternary Expression Parser | [Swift](./Stack/TernaryExpressionParser.swift) | Medium | โ |
Uber
Title | Solution | Difficulty | Frequency |
---|---|---|---|
Valid Sudoku | [Swift](./Array/ValidSudoku.swift) | Easy | โ โ โ โ |
Spiral Matrix | [Swift](./Array/SpiralMatrix.swift) | Medium | โ โ โ โ |
Letter Combinations of a Phone Number | [Swift](./DFS/LetterCombinationsPhoneNumber.swift) | Medium | โ โ โ โ |
Group Anagrams | [Swift](./String/GroupAnagrams.swift) | Medium | โ โ โ โ |
Word Pattern | [Swift](./String/WordPattern.swift) | Easy | โ โ โ |
Roman to Integer | [Swift](./Math/RomanToInteger.swift) | Easy | โ โ โ |
Combination Sum | [Swift](./DFS/CombinationSum.swift) | Medium | โ โ |
Airbnb
Title | Solution | Difficulty | Frequency |
---|---|---|---|
Two Sum | [Swift](./Array/TwoSum.swift) | Easy | โ โ โ โ โ |
Text Justification | [Swift](./String/TextJustification.swift) | Hard | โ โ โ โ |
House Robber | [Swift](./DP/HouseRobber.swift) | Easy | โ โ |
Single Number | [Swift](./Math/SingleNumber.swift) | Medium | โ โ |
Word Search II | [Swift](./DFS/WordSearchII.swift) | Hard | โ โ |
Add Two Numbers | [Swift](./Math/AddTwoNumbers.swift) | Medium | โ โ |
Title | Solution | Difficulty | Frequency |
---|---|---|---|
Maximum Subarray | [Swift](./DP/MaximumSubarray.swift) | Medium | โ โ โ โ โ โ |
Pow(x, n) | [Swift](./Math/Pow.swift) | Medium | โ โ โ โ โ โ |
Merge Intervals | [Swift](./Sort/MergeIntervals.swift) | Hard | โ โ โ โ โ โ |
Isomorphic Strings | [Swift](./String/IsomorphicStrings.swift) | Easy | โ โ โ โ โ โ |
Search in Rotated Sorted Array | [Swift](./Search/SearchInRotatedSortedArray.swift) | Hard | โ โ โ โ โ |
Search for a Range | [Swift](./Search/SearchForARange.swift) | Medium | โ โ โ โ โ |
Two Sum | [Swift](./Array/TwoSum.swift) | Easy | โ โ โ โ |
Binary Tree Level Order Traversal | [Swift](./Tree/BinaryTreeLevelOrderTraversal.swift) | Easy | โ โ โ โ |
Evaluate Reverse Polish Notation | [Swift](./Stack/EvaluateReversePolishNotation.swift) | Medium | โ โ โ |
Maximum Product Subarray | [Swift](./DP/MaximumProductSubarray.swift) | Medium | โ โ โ |
Product of Array Except Self | [Swift](./Array/ProductExceptSelf.swift) | Medium | โ โ โ |
Symmetric Tree | [Swift](./Tree/SymmetricTree.swift) | Easy | โ โ |
Amazon
Title | Solution | Difficulty | Frequency |
---|---|---|---|
Two Sum | [Swift](./Array/TwoSum.swift) | Easy | โ โ โ โ โ โ |
Min Cost Climbing Stairs | [Swift](./DP/MinCostClimbingStairs.swift) | Easy | โ โ โ โ |
Number of Islands | [Swift](./DFS/NumberofIslands.swift) | Medium | โ โ |
Add Two Numbers | [Swift](./Math/AddTwoNumbers.swift) | Medium | โ โ |
Reverse Linked List | [Swift](./LinkedList/ReverseLinkedList.swift) | Easy | โ โ |
Valid Parentheses | [Swift](./Stack/ValidParentheses.swift) | Easy | โ โ |
Longest Palindromic Substring | [Swift](./DP/LongestPalindromicSubstring.swift) | Medium | โ โ |
Trapping Rain Water | [Swift](./Math/TrappingRainWater.swift) | Hard | โ โ |
Longest Substring Without Repeating Characters | [Swift](./String/LongestSubstringWithoutRepeatingCharacters.swift) | Medium | โ โ |
Letter Combinations of a Phone Number | [Swift](./DFS/LetterCombinationsPhoneNumber.swift) | Medium | โ โ |
Valid Anagram | [Swift](./String/ValidAnagram.swift) | Easy | โ โ |
Rotate Image | [Swift](./Array/RotateImage.swift) | Medium | โ โ |
Best Time to Buy and Sell Stock | [Swift](./DP/BestTimeBuySellStock.swift) | Easy | โ โ |
3Sum | [Swift](./Array/ThreeSum.swift) | Medium | โ โ |
Sliding Window Maximum | [Swift](./Array/SlidingWindowMaximum.swift) | Hard | โ โ |
Microsoft
Title | Solution | Difficulty | Frequency |
---|---|---|---|
Reverse Linked List | [Swift](./LinkedList/ReverseLinkedList.swift) | Easy | โ โ โ โ โ โ |
Two Sum | [Swift](./Array/TwoSum.swift) | Easy | โ โ โ โ โ |
String to Integer (atoi) | [Swift](./Math/Atoi.swift) | Easy | โ โ โ โ |
Add Two Numbers | [Swift](./Math/AddTwoNumbers.swift) | Medium | โ โ โ โ |
Excel Sheet Column Number | [Swift](./Math/ExcelSheetColumnNumber.swift) | Easy | โ โ โ โ |
Validate Binary Search Tree | [Swift](./Tree/ValidateBinarySearchTree.swift) | Medium | โ โ โ |
Merge Two Sorted Lists | [Swift](./LinkedList/MergeTwoSortedLists.swift) | Easy | โ โ โ |
Problem Status
Solution | Number | Title | Difficulty |
---|---|---|---|
[Swift](./LinkedList/LFUCache.swift) | 460 | LFU Cache | Hard |
[Swift](./Array/FindDisappearedNumbers.swift) | 448 | Find All Numbers Disappeared in an Array | Easy |
[Swift](./DFS/CombinationSumIV.swift) | 377 | Combination Sum IV | Medium |
376 | Wiggle Subsequence | Medium | |
[Swift](./DP/GuessNumberHigherOrLowerII.swift) | 375 | Guess Number Higher or Lower II | Medium |
374 | Guess Number Higher or Lower | Easy | |
373 | Find K Pairs with Smallest Sums | Medium | |
[Swift](./Math/SuperPow.swift) | 372 | Super Pow | Medium |
[Swift](./Math/SumTwoIntegers.swift) | 371 | Sum of Two Integers | Easy |
370 | Range Addition ♥ | Medium | |
369 | Plus One Linked List ♥ | Medium | |
368 | Largest Divisible Subset | Medium | |
367 | Valid Perfect Square | Medium | |
366 | Find Leaves of Binary Tree ♥ | Medium | |
365 | Water and Jug Problem | Medium | |
[Swift](./DP/NestedListWeightSumII.swift) | 364 | Nested List Weight Sum II ♥ | Medium |
363 | Max Sum of Rectangle No Larger Than K | Hard | |
362 | Design Hit Counter ♥ | Medium | |
361 | Bomb Enemy ♥ | Medium | |
[Swift](./Sort/SortTransformedArray.swift) | 360 | Sort Transformed Array ♥ | Medium |
359 | Logger Rate Limiter ♥ | Easy | |
358 | Rearrange String k Distance Apart ♥ | Hard | |
357 | Count Numbers with Unique Digits | Medium | |
356 | Line Reflection ♥ | Medium | |
355 | Design Twitter | Medium | |
354 | Russian Doll Envelopes | Hard | |
353 | Design Snake Game ♥ | Medium | |
352 | Data Stream as Disjoint Intervals | Hard | |
351 | Android Unlock Patterns ♥ | Medium | |
[Swift](./Array/IntersectionTwoArraysII.swift) | 350 | Intersection of Two Arrays II | Easy |
[Swift](./Array/IntersectionTwoArrays.swift) | 349 | Intersection of Two Arrays | Easy |
348 | Design Tic-Tac-Toe ♥ | Medium | |
[Swift](./Sort/TopKFrequentElements.swift) | 347 | Top K Frequent Elements | Medium |
346 | Moving Average from Data Stream ♥ | Easy | |
[Swift](./String/ReverseVowelsOfAString.swift) | 345 | Reverse Vowels of a String | Easy |
[Swift](./String/ReverseString.swift) | 344 | Reverse String | Easy |
[Swift](./Math/IntegerBreak.swift) | 343 | Integer Break | Medium |
342 | Power of Four | Easy | |
[Swift](./Design/FlattenNestedListIterator.swift) | 341 | Flatten Nested List Iterator | Medium |
[Swift](./String/LongestSubstringMostKDistinctCharacters.swift) | 340 | Longest Substring with At Most K Distinct Characters ♥ | Hard |
[Swift](./DP/NestedListWeightSum.swift) | 339 | Nested List Weight Sum ♥ | Easy |
[Swift](./Math/CountingBits.swift) | 338 | Counting Bits | Medium |
[Swift](./Tree/HouseRobberIII.swift) | 337 | House Robber III | Medium |
336 | Palindrome Pairs | Hard | |
335 | Self Crossing | Hard | |
[Swift](./Tree/IncreasingTripletSubsequence.swift) | 334 | Increasing Triplet Subsequence | Medium |
333 | Largest BST Subtree ♥ | Medium | |
332 | Reconstruct Itinerary | Medium | |
331 | Verify Preorder Serialization of a Binary Tree | Medium | |
330 | Patching Array | Hard | |
329 | Longest Increasing Path in a Matrix | Hard | |
[Swift](./LinkedList/OddEvenLinkedList.swift) | 328 | Odd Even Linked List | Medium |
327 | Count of Range Sum | Hard | |
[Swift](./Math/PowerThree.swift) | 326 | Power of Three | Easy |
[Swift](./Array/MaximumSizeSubarraySumEqualsK.swift) | 325 | Maximum Size Subarray Sum Equals k ♥ | Medium |
[Swift](./Sort/WiggleSortII.swift) | 324 | Wiggle Sort II | Medium |
[Swift](./Sort/NumberConnectedComponentsUndirectedGraph.swift) | 323 | Number of Connected Components in an Undirected Graph ♥ | Medium |
[Swift](./DP/CoinChange.swift) | 322 | Coin Change | Medium |
[Swift](./Array/CreateMaximumNumber.swift) | 321 | Create Maximum Number | Hard |
[Swift](./DFS/GeneralizedAbbreviation.swift) | 320 | Generalized Abbreviation ♥ | Medium |
319 | Bulb Switcher | Medium | |
318 | Maximum Product of Word Lengths | Medium | |
[Swift](./BFS/ShortestDistanceAllBuildings.swift) | 317 | Shortest Distance from All Buildings ♥ | Hard |
316 | Remove Duplicate Letters | Hard | |
315 | Count of Smaller Numbers After Self | Hard | |
[Swift](./Tree/BinaryTreeVerticalOrderTraversal.swift) | 314 | Binary Tree Vertical Order Traversal ♥ | Medium |
[Swift](./Math/SuperUglyNumber.swift) | 313 | Super Ugly Number | Medium |
[Swift](./DP/GuessNumberHigherOrLowerII.swift) | 312 | Burst Balloons | Hard |
[Swift](./Math/SparseMatrixMultiplication.swift) | 311 | Sparse Matrix Multiplication ♥ | Medium |
310 | Minimum Height Trees | Medium | |
[Swift](./DP/BestTimeBuySellStockCooldown.swift) | 309 | Best Time to Buy and Sell Stock with Cooldown | Medium |
308 | Range Sum Query 2D - Mutable ♥ | Hard | |
307 | Range Sum Query - Mutable | Medium | |
306 | Additive Number | Medium | |
[Swift](./Graph/NumberIslandsII.swift) | 305 | Number of Islands II ♥ | Hard |
[Swift](./Array/NumMatrix.swift) | 304 | Range Sum Query 2D - Immutable | Medium |
303 | Range Sum Query - Immutable | Easy | |
302 | Smallest Rectangle Enclosing Black Pixels ♥ | Hard | |
[Swift](./DFS/RemoveInvalidParentheses.swift) | 301 | Remove Invalid Parentheses | Hard |
[Swift](./DP/LongestIncreasingSubsequence.swift) | 300 | Longest Increasing Subsequence | Medium |
299 | Bulls and Cows | Easy | |
298 | Binary Tree Longest Consecutive Sequence ♥ | Medium | |
297 | Serialize and Deserialize Binary Tree | Hard | |
[Swift](./Tree/UniqueBinarySearchTrees.swift) | 296 | Best Meeting Point ♥ | Hard |
295 | Find Median from Data Stream | Hard | |
[Swift](./DP/FlipGameII.swift) | 294 | Flip Game II ♥ | Medium |
[Swift](./String/FlipGame.swift) | 293 | Flip Game ♥ | Easy |
292 | Nim Game | Easy | |
291 | Word Pattern II ♥ | Hard | |
[Swift](./String/WordPattern.swift) | 290 | Word Pattern | Easy |
[Swift](./Array/GameLife.swift) | 289 | Game of Life | Medium |
288 | Unique Word Abbreviation ♥ | Easy | |
287 | Find the Duplicate Number | Hard | |
[Swift](./DFS/NumberofIslands.swift) | 286 | Walls and Gates ♥ | Medium |
285 | Inorder Successor in BST ♥ | Medium | |
284 | Peeking Iterator | Medium | |
[Swift](./Array/MoveZeroes.swift) | 283 | Move Zeroes | Easy |
[Swift](./DFS/ExpressionAddOperators.swift) | 282 | Expression Add Operators | Hard |
281 | Zigzag Iterator ♥ | Medium | |
[Swift](./Sort/WiggleSort.swift) | 280 | Wiggle Sort ♥ | Medium |
[Swift](./DP/PerfectSquares.swift) | 279 | Perfect Squares | Medium |
278 | First Bad Version | Easy | |
277 | Find the Celebrity ♥ | Medium | |
[Swift](./DP/PaintFence.swift) | 276 | Paint Fence ♥ | Easy |
275 | H-Index II | Medium | |
274 | H-Index | Medium | |
[Swift](./Math/IntegerEnglishWords.swift) | 273 | Integer to English Words | Hard |
[Swift](./Search/ClosestBinarySearchTreeValueII.swift) | 272 | Closest Binary Search Tree Value II ♥ | Hard |
271 | Encode and Decode Strings ♥ | Medium | |
[Swift](./Search/ClosestBinarySearchTreeValue.swift) | 270 | Closest Binary Search Tree Value ♥ | Easy |
[Swift](./Graph/AlienDictionary.swift) | 269 | Alien Dictionary ♥ | Hard |
[Swift](./Math/MissingNumber.swift) | 268 | Missing Number | Easy |
267 | Palindrome Permutation II ♥ | Medium | |
[Swift](./String/PalindromePermutation.swift) | 266 | Palindrome Permutation ♥ | Easy |
[Swift](./DP/PaintHouseII.swift) | 265 | Paint House II ♥ | Hard |
[Swift](./Math/UglyNumberII.swift) | 264 | Ugly Number II | Medium |
[Swift](./Math/UglyNumber.swift) | 263 | Ugly Number | Easy |
[Swift](./Sort/GraphValidTree.swift) | 261 | Graph Valid Tree ♥ | Medium |
260 | Single Number III | Medium | |
259 | 3Sum Smaller ♥ | Medium | |
[Swift](./Math/AddDigits.swift) | 258 | Add Digits | Easy |
[Swift](./Tree/BinaryTreePaths.swift) | 257 | Binary Tree Paths | Easy |
[Swift](./DP/PaintHouse.swift) | 256 | Paint House ♥ | Medium |
255 | Verify Preorder Sequence in Binary Search Tree ♥ | Medium | |
[Swift](./DFS/FactorCombinations.swift) | 254 | Factor Combinations ♥ | Medium |
[Swift](./Sort/MeetingRoomsII.swift) | 253 | Meeting Rooms II ♥ | Medium |
[Swift](./Sort/MeetingRooms.swift) | 252 | Meeting Rooms ♥ | Easy |
[Swift](./Design/Vector2D.swift) | 251 | Flatten 2D Vector ♥ | Medium |
250 | Count Univalue Subtrees ♥ | Medium | |
249 | Group Shifted Strings ♥ | Easy | |
248 | Strobogrammatic Number III ♥ | Hard | |
[Swift](./DFS/StrobogrammaticNumberII.swift) | 247 | Strobogrammatic Number II ♥ | Medium |
[Swift](./Array/StrobogrammaticNumber.swift) | 246 | Strobogrammatic Number ♥ | Easy |
[Swift](./Array/ShortestWordDistanceIII.swift) | 245 | Shortest Word Distance III ♥ | Medium |
[Swift](./String/ShortestWordDistanceII.swift) | 244 | Shortest Word Distance II ♥ | Medium |
[Swift](./String/ShortestWordDistance.swift) | 243 | Shortest Word Distance ♥ | Easy |
[Swift](./String/ValidAnagram.swift) | 242 | Valid Anagram | Easy |
[Swift](./DP/DifferentWaysAddParentheses.swift) | 241 | Different Ways to Add Parentheses | Medium |
[Swift](./Search/Search2DMatrixII.swift) | 240 | Search a 2D Matrix II | Medium |
[Swift](./Array/SlidingWindowMaximum.swift) | 239 | Sliding Window Maximum | Hard |
[Swift](./Array/ProductExceptSelf.swift) | 238 | Product of Array Except Self | Medium |
237 | Delete Node in a Linked List | Easy | |
236 | Lowest Common Ancestor of a Binary Tree | Medium | |
[Swift](./Tree/LowestCommonAncestorBinarySearchTree.swift) | 235 | Lowest Common Ancestor of a Binary Search Tree | Easy |
[Swift](./LinkedList/PalindromeLinkedList.swift) | 234 | Palindrome Linked List | Easy |
233 | Number of Digit One | Hard | |
[Swift](./Queue/ImplementQueueUsingStacks.swift) | 232 | Implement Queue using Stacks | Easy |
[Swift](./Math/PowerTwo.swift) | 231 | Power of Two | Easy |
[Swift](./Tree/KthSmallestElementBST.swift) | 230 | Kth Smallest Element in a BST | Medium |
[Swift](./Array/MajorityElementII.swift) | 229 | Majority Element II | Medium |
[Swift](./Array/SummaryRanges.swift) | 228 | Summary Ranges | Medium |
227 | Basic Calculator II | Medium | |
[Swift](./Tree/InvertBinaryTree.swift) | 226 | Invert Binary Tree | Easy |
225 | Implement Stack using Queues | Easy | |
[Swift](./Stack/BasicCalculator.swift) | 224 | Basic Calculator | Hard |
[Swift](./Math/RectangleArea.swift) | 223 | Rectangle Area | Easy |
222 | Count Complete Tree Nodes | Medium | |
[Swift](./DP/MaximalSquare.swift) | 221 | Maximal Square | Medium |
220 | Contains Duplicate III | Medium | |
[Swift](./Array/ContainsDuplicateII.swift) | 219 | Contains Duplicate II | Easy |
218 | The Skyline Problem | Hard | |
[Swift](./Array/ContainsDuplicate.swift) | 217 | Contains Duplicate | Easy |
[Swift](./DFS/combinationSumIII.swift) | 216 | Combination Sum III | Medium |
[Swift](./Sort/KthLargestElementInArray.swift) | 215 | Kth Largest Element in an Array | Medium |
214 | Shortest Palindrome | Hard | |
[Swift](./DP/HouseRobberII.swift) | 213 | House Robber II | Medium |
[Swift](./DFS/WordSearchII.swift) | 212 | Word Search II | Hard |
[Swift](./DFS/WordDictionary.swift) | 211 | Add and Search Word - Data structure design | Medium |
[Swift](./Graph/CourseScheduleII.swift) | 210 | Course Schedule II | Medium |
[Swift](./Array/MinimumSizeSubarraySum.swift) | 209 | Minimum Size Subarray Sum | Medium |
[Swift](./Design/ImplementTrie.swift) | 208 | Implement Trie (Prefix Tree) | Medium |
[Swift](./Graph/CourseSchedule.swift) | 207 | Course Schedule | Medium |
[Swift](./LinkedList/ReverseLinkedList.swift) | 206 | Reverse Linked List | Easy |
[Swift](./String/IsomorphicStrings.swift) | 205 | Isomorphic Strings | Easy |
[Swift](./Math/CountPrimes.swift) | 204 | Count Primes | Easy |
[Swift](./LinkedList/RemoveLinkedListElements.swift) | 203 | Remove Linked List Elements | Easy |
[Swift](./Math/HappyNumber.swift) | 202 | Happy Number | Easy |
201 | Bitwise AND of Numbers Range | Medium | |
[Swift](./DFS/NumberofIslands.swift) | 200 | Number of Islands | Medium |
[Swift](./Tree/BinaryTreeRightSideView.swift) | 199 | Binary Tree Right Side View | Medium |
[Swift](./DP/HouseRobber.swift) | 198 | House Robber | Easy |
191 | Number of 1 Bits | Easy | |
190 | Reverse Bits | Easy | |
[Swift](./Array/RotateArray.swift) | 189 | Rotate Array | Easy |
[Swift](./DP/BestTimeBuySellStockIV.swift) | 188 | Best Time to Buy and Sell Stock IV | Hard |
187 | Repeated DNA Sequences | Medium | |
[Swift](./String/ReverseWordsStringII.swift) | 186 | Reverse Words in a String II ♥ | Medium |
[Swift]((./Sort/LargestNumber.swift)) | 179 | Largest Number | Medium |
174 | Dungeon Game | Hard | |
[Swift](./Stack/BinarySearchTreeIterator.swift) | 173 | Binary Search Tree Iterator | Medium |
[Swift](./Math/FactorialTrailingZeroes.swift) | 172 | Factorial Trailing Zeroes | Easy |
[Swift](./Math/ExcelSheetColumnNumber.swift) | 171 | Excel Sheet Column Number | Easy |
[Swift](./Array/TwoSumIII.swift) | 170 | Two Sum III - Data structure design ♥ | Easy |
[Swift](./Array/MajorityElement.swift) | 169 | Majority Element | Easy |
168 | Excel Sheet Column Title | Easy | |
[Swift](./Array/TwoSumII.swift) | 167 | Two Sum II - Input array is sorted ♥ | Medium |
[Swift](./Math/FractionToRecurringDecimal.swift) | 166 | Fraction to Recurring Decimal | Medium |
165 | Compare Version Numbers | Easy | |
164 | Maximum Gap | Hard | |
[Swift](./Array/MissingRanges.swift) | 163 | Missing Ranges ♥ | Medium |
[Swift](./Search/FindPeakElement.swift) | 162 | Find Peak Element | Medium |
[Swift](./String/OneEditDistance.swift) | 161 | One Edit Distance♥ | Medium |
160 | Intersection of Two Linked Lists | Easy | |
[Swift](./String/LongestSubstringMostTwoDistinctCharacters.swift) | 159 | Longest Substring with At Most Two Distinct Characters ♥ | Hard |
158 | Read N Characters Given Read4 II - Call multiple times ♥ | Hard | |
157 | Read N Characters Given Read4 ♥ | Easy | |
[Swift](./Tree/BinaryTreeUpsideDown) | 156 | Binary Tree Upside Down ♥ | Medium |
[Swift](./Stack/MinStack.swift) | 155 | Min Stack | Easy |
[Swift](./Search/FindMinimumRotatedSortedArrayII.swift) | 154 | Find Minimum in Rotated Sorted Array II | Hard |
[Swift](./Search/FindMinimumRotatedSortedArray.swift) | 153 | Find Minimum in Rotated Sorted Array | Medium |
[Swift](./DP/MaximumProductSubarray.swift) | 152 | Maximum Product Subarray | Medium |
[Swift](./String/ReverseWordsString.swift) | 151 | Reverse Words in a String | Medium |
[Swift](./Stack/EvaluateReversePolishNotation.swift) | 150 | Evaluate Reverse Polish Notation | Medium |
149 | Max Points on a Line | Hard | |
148 | Sort List | Medium | |
147 | Insertion Sort List | Medium | |
[Swift](./LinkedList/LRUCache.swift) | 146 | LRU Cache | Hard |
[Swift](./Stack/PostorderTraversal.swift) | 145 | Binary Tree Postorder Traversal | Hard |
[Swift](./Stack/PreorderTraversal.swift) | 144 | Binary Tree Preorder Traversal | Medium |
[Swift](./LinkedList/ReorderList.swift) | 143 | Reorder List | Medium |
142 | Linked List Cycle II | Medium | |
141 | Linked List Cycle | Easy | |
140 | Word Break II | Hard | |
139 | Word Break | Medium | |
138 | Copy List with Random Pointer | Hard | |
[Swift](./Math/SingleNumberII.swift) | 137 | Single Number II | Medium |
[Swift](./Math/SingleNumber.swift) | 136 | Single Number | Medium |
135 | Candy | Hard | |
[Swift](./Array/GasStation.swift) | 134 | Gas Station | Medium |
133 | Clone Graph | Medium | |
132 | Palindrome Partitioning II | Hard | |
[Swift](./DFS/PalindromePartitioning.swift) | 131 | Palindrome Partitioning | Medium |
130 | Surrounded Regions | Medium | |
129 | Sum Root to Leaf Numbers | Medium | |
[Swift](./Array/LongestConsecutiveSequence.swift) | 128 | Longest Consecutive Sequence | Hard |
[Swift](./BFS/WordLadder.swift) | 127 | Word Ladder | Medium |
126 | Word Ladder II | Hard | |
[Swift](./String/ValidPalindrome.swift) | 125 | Valid Palindrome | Easy |
[Swift](./Tree/BinaryTreeMaximumPathSum.swift) | 124 | Binary Tree Maximum Path Sum | Hard |
[Swift](./DP/BestTimeBuySellStockIII.swift) | 123 | Best Time to Buy and Sell Stock III | Hard |
[Swift](./DP/BestTimeBuySellStockII.swift) | 122 | Best Time to Buy and Sell Stock II | Medium |
[Swift](./DP/BestTimeBuySellStock.swift) | 121 | Best Time to Buy and Sell Stock | Easy |
[Swift](./DP/Triangle.swift) | 120 | Triangle | Medium |
119 | Pascal's Triangle II | Easy | |
118 | Pascal's Triangle | Easy | |
117 | Populating Next Right Pointers in Each Node II | Hard | |
116 | Populating Next Right Pointers in Each Node | Medium | |
115 | Distinct Subsequences | Hard | |
[Swift](./Tree/FlattenBinaryTreeLinkedList.swift) | 114 | Flatten Binary Tree to Linked List | Medium |
[Swift](./Tree/PathSumII.swift) | 113 | Path Sum II | Medium |
[Swift](./Tree/PathSum.swift) | 112 | Path Sum | Easy |
[Swift](./Tree/MinimumDepthOfBinaryTree.swift) | 111 | Minimum Depth of Binary Tree | Easy |
[Swift](./Tree/BalancedBinaryTree.swift) | 110 | Balanced Binary Tree | Easy |
109 | Convert Sorted List to Binary Search Tree | Medium | |
[Swift](./Tree/ConvertSortedArrayBinarySearchTree.swift) | 108 | Convert Sorted Array to Binary Search Tree | Medium |
[Swift](./Tree/BinaryTreeLevelOrderTraversalII.swift) | 107 | Binary Tree Level Order Traversal II | Easy |
[Swift](./Tree/ConstructBinaryTreeInorderPostorder.swift) | 106 | Construct Binary Tree from Inorder and Postorder Traversal | Medium |
[Swift](./Tree/ConstructBinaryTreePreorderInorder.swift) | 105 | Construct Binary Tree from Preorder and Inorder Traversal | Medium |
[Swift](./Tree/MaximumDepthOfBinaryTree.swift) | 104 | Maximum Depth of Binary Tree | Easy |
[Swift](./Tree/BinaryTreeZigzagLevelOrderTraversal.swift) | 103 | Binary Tree Zigzag Level Order Traversal | Medium |
[Swift](./Tree/BinaryTreeLevelOrderTraversal.swift) | 102 | Binary Tree Level Order Traversal | Easy |
[Swift](./Tree/SymmetricTree.swift) | 101 | Symmetric Tree | Easy |
[Swift](./Tree/SameTree.swift) | 100 | Same Tree | Easy |
[Swift](./Tree/RecoverBinarySearchTree.swift) | 99 | Recover Binary Search Tree | Hard |
[Swift](./Tree/ValidateBinarySearchTree.swift) | 98 | Validate Binary Search Tree | Medium |
97 | Interleaving String | Hard | |
[Swift](./Tree/UniqueBinarySearchTrees.swift) | 96 | Unique Binary Search Trees | Medium |
95 | Unique Binary Search Trees II | Medium | |
[Swift](./Stack/InorderTraversal.swift) | 94 | Binary Tree Inorder Traversal | Medium |
93 | Restore IP Addresses | Medium | |
92 | Reverse Linked List II | Medium | |
[Swift](./DP/DecodeWays.swift) | 91 | Decode Ways | Medium |
[Swift](./DFS/SubsetsII.swift) | 90 | Subsets II | Medium |
[Swift](./Math/GaryCode.swift) | 89 | Gray Code | Medium |
[Swift](./Sort/MergeSortedArray.swift) | 88 | Merge Sorted Array | Easy |
87 | Scramble String | Hard | |
[Swift](./LinkedList/PartitionList.swift) | 86 | Partition List | Medium |
85 | Maximal Rectangle | Hard | |
84 | Largest Rectangle in Histogram | Hard | |
[Swift](./LinkedList/RemoveDuplicatesFromSortedList.swift) | 83 | Remove Duplicates from Sorted List | Easy |
[Swift](./LinkedList/RemoveDuplicatesFromSortedListII.swift) | 82 | Remove Duplicates from Sorted List II | Medium |
[Swift](./Search/SearchInRotatedSortedArrayII.swift) | 81 | Search in Rotated Sorted Array II | Medium |
[Swift](./Array/RemoveDuplicatesFromSortedArrayII.swift) | 80 | Remove Duplicates from Sorted Array II | Medium |
[Swift](./DFS/WordSearch.swift) | 79 | Word Search | Medium |
[Swfit](./DFS/Subsets.swift) | 78 | Subsets | Medium |
[Swift](./DFS/combinations.swift) | 77 | Combinations | Medium |
[Swift](./Array/MinimumWindowSubstring.swift) | 76 | Minimum Window Substring | Hard |
[Swift](./Sort/SortColors.swift) | 75 | Sort Colors | Medium |
[Swift](./Search/Search2DMatrix.swift) | 74 | Search a 2D Matrix | Medium |
[Swift](./Array/SetMatrixZero.swift) | 73 | Set Matrix Zeroes | Medium |
[Swift](./DP/EditDistance.swift) | 72 | Edit Distance | Hard |
[Swift](./Stack/SimplifyPath.swift) | 71 | Simplify Path | Medium |
[Swift](./DP/ClimbingStairs.swift) | 70 | Climbing Stairs | Easy |
[Swift](./Search/Sqrtx.swift) | 69 | Sqrt(x) | Medium |
[Swift](./String/TextJustification.swift) | 68 | Text Justification | Hard |
[Swift](./Math/AddBinary.swift) | 67 | Add Binary | Easy |
[Swift](./Math/PlusOne.swift) | 66 | Plus One | Easy |
[Swift](./Math/ValidNumber.swift) | 65 | Valid Number | Hard |
[Swift](./DP/MinimumPathSum.swift) | 64 | Minimum Path Sum | Medium |
[Swift](./DP/UniquePathsII.swift) | 63 | Unique Paths II | Medium |
[Swift](./DP/UniquePaths.swift) | 62 | Unique Paths | Medium |
[Swift](./LinkedList/RotateList.swift) | 61 | Rotate List | Medium |
[Swift](./Math/PermutationSequence.swift) | 60 | Permutation Sequence | Medium |
[Swift](./Array/SpiralMatrixII.swift) | 59 | Spiral Matrix II | Medium |
[Swift](./String/LengthLastWord.swift) | 58 | Length of Last Word | Easy |
[Swift](./Sort/InsertInterval.swift) | 57 | Insert Interval | Hard |
[Swift](./Sort/MergeIntervals.swift) | 56 | Merge Intervals | Hard |
[Swift](./DP/JumpGame.swift) | 55 | Jump Game | Medium |
[Swift](./Array/SpiralMatrix.swift) | 54 | Spiral Matrix | Medium |
[Swift](./DP/MaximumSubarray.swift) | 53 | Maximum Subarray | Medium |
[Swift](./DFS/NQueensII.swift) | 52 | N-Queens II | Hard |
[Swift](./DFS/NQueens.swift) | 51 | N-Queens | Hard |
[Swift](./Math/Pow.swift) | 50 | "Pow(x, n)" | Medium |
[Swift](./String/GroupAnagrams.swift) | 49 | Group Anagrams | Medium |
[Swift](./Array/RotateImage.swift) | 48 | Rotate Image | Medium |
[Swift](./DFS/PermutationsII.swift) | 47 | Permutations II | Medium |
[Swift](./DFS/Permutations.swift) | 46 | Permutations | Medium |
45 | Jump Game II | Hard | |
[Swift](./DP/WildcardMatching.swift) | 44 | Wildcard Matching | Hard |
[Swift](./String/MultiplyStrings.swift) | 43 | Multiply Strings | Medium |
[Swift](./Math/TrappingRainWater.swift) | 42 | Trapping Rain Water | Hard |
[Swift](./Array/FirstMissingPositive.swift) | 41 | First Missing Positive | Hard |
[Swift](./DFS/combinationSumII.swiftc) | 40 | Combination Sum II | Medium |
[Swift](./DFS/CombinationSum.swift) | 39 | Combination Sum | Medium |
[Swift](./String/CountAndSay.swift) | 38 | Count and Say | Easy |
[Swift](./Math/SudokuSolver.swift) | 37 | Sudoku Solver | Hard |
[Swift](./Array/ValidSudoku.swift) | 36 | Valid Sudoku | Easy |
[Swift](./Search/SearchInsertPosition.swift) | 35 | Search Insert Position | Medium |
[Swift](./Search/SearchForARange.swift) | 34 | Search for a Range | Medium |
[Swift](./Search/SearchInRotatedSortedArray.swift) | 33 | Search in Rotated Sorted Array | Hard |
[Swift](./Stack/LongestValidParentheses.swift) | 32 | Longest Valid Parentheses | Hard |
[Swift](./Array/NextPermutation.swift) | 31 | Next Permutation | Medium |
30 | Substring with Concatenation of All Words | Hard | |
[Swift](./Math/DivideTwoIntegers.swift) | 29 | Divide Two Integers | Medium |
[Swift](./String/StrStr.swift) | 28 | Implement strStr() | Easy |
[Swfit](./Array/RemoveElement.swift) | 27 | Remove Element | Easy |
[Swift](./Array/RemoveDuplicatesFromSortedArray.swift) | 26 | Remove Duplicates from Sorted Array | Easy |
[Swift](./LinkedList/ReverseNodesInKGroup.swift) | 25 | Reverse Nodes in k-Group | Hard |
[Swift](./LinkedList/SwapNodesInPairs.swift) | 24 | Swap Nodes in Pairs | Easy |
[Swift](./LinkedList/MergeKSortedLists.swift) | 23 | Merge k Sorted Lists | Hard |
[Swift](./Math/GenerateParentheses.swift) | 22 | Generate Parentheses | Medium |
[Swift](./LinkedList/MergeTwoSortedLists.swift) | 21 | Merge Two Sorted Lists | Easy |
[Swift](./Stack/ValidParentheses.swift) | 20 | Valid Parentheses | Easy |
[Swift](./LinkedList/RemoveNthFromEnd.swift) | 19 | Remove Nth Node From End of List | Easy |
[Swift](./Array/FourSum.swift) | 18 | 4Sum | Medium |
[Swift](./DFS/LetterCombinationsPhoneNumber.swift) | 17 | Letter Combinations of a Phone Number | Medium |
[Swift](./Array/ThreeSum.swift) | 16 | 3Sum Closest | Medium |
[Swift](./Array/ThreeSum.swift) | 15 | 3Sum | Medium |
[Swift](./String/LongestCommonPrefix.swift) | 14 | Longest Common Prefix | Easy |
[Swift](./Math/RomanToInteger.swift) | 13 | Roman to Integer | Easy |
[Swift](./Math/IntegerToRoman.swift) | 12 | Integer to Roman | Medium |
[Swift](./Math/ContainerMostWater.swift) | 11 | Container With Most Water | Medium |
[Swift](./DP/RegularExpressionMatching.swift) | 10 | Regular Expression Matching | Hard |
[Swift](./Math/PalindromeNumber.swift) | 9 | Palindrome Number | Easy |
[Swift](./Math/Atoi.swift) | 8 | String to Integer (atoi) | Easy |
[Swift](./Math/ReverseInteger.swift) | 7 | Reverse Integer | Easy |
[Swift](./String/ZigZagConversion.swift) | 6 | ZigZag Conversion | Easy |
[Swift](./DP/LongestPalindromicSubstring.swift) | 5 | Longest Palindromic Substring | Medium |
[Swift](./Search/MedianOfTwoSortedArrays.swift) | 4 | Median of Two Sorted Arrays | Hard |
[Swift](./String/LongestSubstringWithoutRepeatingCharacters.swift) | 3 | Longest Substring Without Repeating Characters | Medium |
[Swift](./Math/AddTwoNumbers.swift) | 2 | Add Two Numbers | Medium |
[Swift](./Array/TwoSum.swift) | 1 | Two Sum | Easy |