Skip to content

Lafree317/LeetCode_Swift

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode by Swift

[LeetCode Online Judge] (https://leetcode.com/) 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 and the code style strictly follows the RayWenderlich Swift Style Guide. Please feel free to reference and STAR to support this repo, thank you!

Leetcode

Data Structures

Companies

Progress

Problem Status shows the latest progress of solutions to all 300+ questions. The questions with ♥ mark means that you have to Subscript to premium membership of LeetCode to unlock them.

Array

Title Solution Difficulty Time Space
Summary Ranges Swift Medium O(n) O(n)
Intersection of Two Arrays Swift Easy O(n) O(n)
Intersection of Two Arrays II Swift Easy O(nlogn) O(n)
Contains Duplicate Swift Easy O(n) O(n)
Contains Duplicate II Swift Easy O(n) O(n)
Remove Duplicates from Sorted Array Swift Easy O(n) O(1)
Remove Duplicates from Sorted Array II Swift Medium O(n) O(1)
Move Zeroes Swift Easy O(n) O(1)
Remove Element Swift Easy O(n) O(1)
Two Sum Swift Easy O(n) O(n)
3Sum Swift Medium O(n^2) O(n)
4Sum Swift Medium O(n^3) O(n)
Maximum Size Subarray Sum Equals k Swift Easy O(n) O(n)
Product of Array Except Self Swift Medium O(n) O(n)
Rotate Array Swift Easy O(n) O(1)
Rotate Image Swift Medium O(n^2) O(1)
Spiral Matrix Swift Medium O(n^2) O(1)
Spiral Matrix II Swift Medium O(n^2) O(1)
Valid Sudoku Swift Easy O(n^2) O(n)
Sliding Window Maximum Swift Hard O(n) O(n)

String

Title Solution Difficulty Time Space
Count and Say Swift Easy O(n^2) O(n)
Flip Game Swift Easy O(n) O(n)
Implement strStr() Swift Easy O(nm) O(n)
Isomorphic Strings Swift Easy O(n) O(n)
Reverse String Swift Easy O(n) O(n)
Reverse Vowels of a String Swift Easy O(n) O(n)
Length of Last Word Swift Easy O(n) O(n)
Palindrome Permutation Swift Easy O(n) O(n)
Valid Anagram Swift Easy O(nlogn) O(1)
Group Anagrams Swift Medium O(nmlogm + nlogn) O(n)
Longest Common Prefix Swift Easy O(nm) O(m)
Longest Substring Without Repeating Characters Swift Medium O(n) O(n)
One Edit Distance Swift Medium O(n) O(n)
Word Pattern Swift Easy O(n) O(n)
Text Justification Swift Hard O(n^2) O(n)

Linked List

Title Solution Difficulty Time Space
Reverse Linked List Swift Easy O(n) O(1)
Palindrome Linked List Swift Easy O(n) O(1)
Swap Nodes in Pairs Swift Easy O(n) O(1)
Remove Linked List Elements Swift Easy O(n) O(1)
Remove Duplicates from Sorted List Swift Easy O(n) O(1)
Remove Duplicates from Sorted List II Swift Medium O(n) O(1)
Remove Nth Node From End of List Swift Easy O(n) O(1)
Rotate List Swift Medium O(n) O(1)
Reorder List Swift Medium O(n) O(1)
Merge Two Sorted Lists Swift Easy O(n) O(1)
Merge k Sorted Lists Swift Hard O(mlogn) O(1)
Partition List Swift Medium O(n) O(1)

Stack

Title Solution Difficulty Time Space
Valid Parentheses Swift Easy O(n) O(n)
Evaluate Reverse Polish Notation Swift Medium O(n) O(n)
Simplify Path Swift Medium O(n) O(n)
Binary Tree Preorder Traversal Swift Medium O(n) O(n)
Binary Tree Inorder Traversal Swift Medium O(n) O(n)
Binary Tree Postorder Traversal Swift Hard O(n) O(n)

Tree

Title Solution Difficulty Time Space
Same Tree Swift Easy O(n) O(1)
Symmetric Tree Swift Easy O(n) O(1)
Invert Binary Tree Swift Easy O(n) O(1)
Minimum Depth of Binary Tree Swift Easy O(n) O(1)
Maximum Depth of Binary Tree Swift Easy O(n) O(1)
Balanced Binary Tree Swift Easy O(n) O(1)
Validate Binary Search Tree Swift Medium O(n) O(1)
Binary Tree Level Order Traversal Swift Easy O(n) O(n)
Binary Tree Level Order Traversal II Swift Easy O(n) O(n)
Binary Tree Zigzag Level Order Traversal Swift Medium O(n) O(n)
Construct Binary Tree from Preorder and Inorder Traversal Swift Medium O(n) O(1)
Construct Binary Tree from Inorder and Postorder Traversal Swift Medium O(n) O(1)
Path Sum Swift Easy O(n) O(1)
Path Sum II Swift Medium O(n) O(1)

Dynamic programming

Title Solution Difficulty Time Space
Nested List Weight Sum Swift Easy O(n) O(1)
Climbing Stairs Swift Easy O(n) O(1)
Unique Paths Swift Medium O(mn) O(mn)
Unique Paths II Swift Medium O(mn) O(mn)
Generate Parentheses Swift Medium O(n^2) O(n)
Best Time to Buy and Sell Stock Swift Easy O(n) O(1)
Coin Change Swift Medium O(n^2) O(n)
Longest Increasing Subsequence Swift Medium O(n^2) O(n)
Longest Palindromic Substring Swift Medium O(n^2) O(n^2)
Perfect Squares Swift Medium O(n^2) O(n)
House Robber Swift Easy O(n) O(1)
House Robber II Swift Medium O(n) O(1)
Maximum Subarray Swift Medium O(n) O(1)
Maximum Product Subarray Swift Medium O(n) O(1)
Maximal Square Swift Medium O(mn) O(mn)
Edit Distance Swift Hard O(mn) O(mn)

Depth-first search

Title Solution Difficulty Time Space
Permutations Swift Medium O(n!) O(n)
Permutations II Swift Medium O(n!) O(n)
Subsets Swift Medium O(n!) O(n)
Subsets II Swift Medium O(n!) O(n)
Combinations Swift Medium O(n!) O(n)
Combination Sum Swift Medium O(n^n) O(2^n - 1)
Combination Sum II Swift Medium O(n!) O(2^n - 2)
Combination Sum III Swift Medium O(n!) O(nCk)
Letter Combinations of a Phone Number Swift Medium O(mn) O(n)
Number of Islands Swift Medium O(mn) O(1)
Word Search Swift Medium O((n^2)!) O(n^2)

Math

Title Solution Difficulty Time Space
Add Binary Swift Easy O(n) O(n)
Add Two Numbers Swift Medium O(n) O(1)
Plus One Swift Easy O(n) O(1)
Integer Break Swift Medium O(logn) O(1)
Happy Number Swift Easy O(n) O(n)
Single Number Swift Medium O(n) O(1)
Ugly Number Swift Easy O(logn) O(1)
Ugly Number II Swift Medium O(n) O(n)
Super Ugly Number Swift Medium O(n^2) O(n)
String to Integer (atoi) Swift Easy O(n) O(1)
Pow(x, n) Swift Medium O(logn) O(1)
Power of Two Swift Easy O(1) O(1)
Power of Three Swift Easy O(1) O(1)
Sum of Two Integers Swift Easy O(n) O(1)
Excel Sheet Column Number Swift Easy O(n) O(1)
Roman to Integer Swift Easy O(n) O(n)
Trapping Rain Water Swift Hard O(n) O(n)

Search

Title Solution Difficulty Time Space
Closest Binary Search Tree Value Swift Easy O(logn) O(1)
Search in Rotated Sorted Array Swift Hard O(logn) O(1)
Search in Rotated Sorted Array II Swift Medium O(logn) O(1)
Find Minimum in Rotated Sorted Array Swift Medium O(logn) O(1)
Find Minimum in Rotated Sorted Array II Swift Hard O(logn) O(1)
Search for a Range Swift Medium O(logn) O(1)
Search Insert Position Swift Medium O(logn) O(1)
Find Peak Element Swift Medium O(logn) O(1)
Sqrt(x) Swift Medium O(logn) O(1)

Sort

Title Solution Difficulty Time Space
Sort Colors Swift Medium O(n) O(1)
Wiggle Sort Swift Medium O(n) O(1)
Wiggle Sort II Swift Medium O(nlogn) O(n)
Top K Frequent Elements Swift Medium O(nlogn) O(n)
Meeting Rooms Swift Easy O(nlogn) O(1)
Merge Intervals Swift Hard O(nlogn) O(n)

Google

Title Solution Difficulty Frequency
Plus One Swift Easy ★★★★★★
Number of Islands Swift Medium ★★★★
Summary Ranges Swift Medium ★★★★
Perfect Squares Swift Medium ★★★★
Merge Intervals Swift Hard ★★★
Valid Parentheses Swift Easy ★★★
Trapping Rain Water Swift Hard ★★
Merge k Sorted Lists Swift Hard ★★
Find Peak Element Swift Medium ★★
Spiral Matrix Swift Medium ★★
Sliding Window Maximum Swift Hard ★★
Power of Two Swift Easy ★★

Facebook

Title Solution Difficulty Frequency
3Sum Swift Medium ★★★★★★
Move Zeroes Swift Easy ★★★★★★
Add Binary Swift Easy ★★★★★
Two Sum Swift Easy ★★★★★
Letter Combinations of a Phone Number Swift Medium ★★★★
Merge k Sorted Lists Swift Hard ★★★★
Reverse Linked List Swift Easy ★★★
Merge Intervals Swift Hard ★★★
Subsets Swift Medium ★★★

LinkedIn

Title Solution Difficulty Frequency
Maximum Subarray Swift Medium ★★★★★★
Pow(x, n) Swift Medium ★★★★★★
Merge Intervals Swift Hard ★★★★★★
Isomorphic Strings Swift Easy ★★★★★★
Search in Rotated Sorted Array Swift Hard ★★★★★
Search for a Range Swift Medium ★★★★★
Two Sum Swift Easy ★★★★
Binary Tree Level Order Traversal Swift Easy ★★★★
Evaluate Reverse Polish Notation Swift Medium ★★★
Maximum Product Subarray Swift Medium ★★★
Product of Array Except Self Swift Medium ★★★

Amazon

Title Solution Difficulty Frequency
Two Sum Swift Easy ★★★★★★
Number of Islands Swift Medium ★★
Add Two Numbers Swift Medium ★★
Reverse Linked List Swift Easy ★★
Valid Parentheses Swift Easy ★★
Longest Palindromic Substring Swift Medium ★★
Trapping Rain Water Swift Hard ★★
Longest Substring Without Repeating Characters Swift Medium ★★
Letter Combinations of a Phone Number Swift Medium ★★
Valid Anagram Swift Easy ★★
Rotate Image Swift Medium ★★
Best Time to Buy and Sell Stock Swift Easy ★★
3Sum Swift Medium ★★
Sliding Window Maximum Swift Hard ★★

Microsoft

Title Solution Difficulty Frequency
Reverse Linked List Swift Easy ★★★★★★
Two Sum Swift Easy ★★★★★
String to Integer (atoi) Swift Easy ★★★★
Add Two Numbers Swift Medium ★★★★
Excel Sheet Column Number Swift Easy ★★★★
Validate Binary Search Tree Swift Medium ★★★
Merge Two Sorted Lists Swift Easy ★★★

Problem Status

Solution Number Title Difficulty
375 Guess Number Higher or Lower II ♥ ♥
374 Guess Number Higher or Lower
373 Find K Pairs with Smallest Sums ♥ ♥
Swift 372 Super Pow ♥ ♥
Swift 371 Sum of Two Integers
370 Range Addition ♥ ♥
369 Plus One Linked List ♥ ♥
368 Largest Divisible Subset ♥ ♥
367 Valid Perfect Square ♥ ♥
366 Find Leaves of Binary Tree ♥ ♥
365 Water and Jug Problem ♥ ♥
364 Nested List Weight Sum II ♥ ♥
363 Max Sum of Rectangle No Larger Than K ♥ ♥ ♥
362 Design Hit Counter ♥ ♥
361 Bomb Enemy ♥ ♥
360 Sort Transformed Array ♥ ♥
359 Logger Rate Limiter
358 Rearrange String k Distance Apart ♥ ♥ ♥
357 Count Numbers with Unique Digits ♥ ♥
356 Line Reflection ♥ ♥
355 Design Twitter ♥ ♥
354 Russian Doll Envelopes ♥ ♥ ♥
353 Design Snake Game ♥ ♥
352 Data Stream as Disjoint Intervals ♥ ♥ ♥
351 Android Unlock Patterns ♥ ♥
Swift 350 Intersection of Two Arrays II
Swift 349 Intersection of Two Arrays
348 Design Tic-Tac-Toe ♥ ♥
Swift 347 Top K Frequent Elements ♥ ♥
346 Moving Average from Data Stream
Swift 345 Reverse Vowels of a String
Swift 344 Reverse String
Swift 343 Integer Break ♥ ♥
342 Power of Four
341 Flatten Nested List Iterator ♥ ♥
340 Longest Substring with At Most K Distinct Characters ♥ ♥ ♥
Swift 339 Nested List Weight Sum
338 Counting Bits ♥ ♥
337 House Robber III ♥ ♥
336 Palindrome Pairs ♥ ♥ ♥
335 Self Crossing ♥ ♥ ♥
334 Increasing Triplet Subsequence ♥ ♥
333 Largest BST Subtree ♥ ♥
332 Reconstruct Itinerary ♥ ♥
331 Verify Preorder Serialization of a Binary Tree ♥ ♥
330 Patching Array ♥ ♥ ♥
329 Longest Increasing Path in a Matrix ♥ ♥ ♥
328 Odd Even Linked List ♥ ♥
327 Count of Range Sum ♥ ♥ ♥
Swift 326 Power of Three
Swift 325 Maximum Size Subarray Sum Equals k ♥ ♥
Swift 324 Wiggle Sort II ♥ ♥
323 Number of Connected Components in an Undirected Graph ♥ ♥
Swift 322 Coin Change ♥ ♥
321 Create Maximum Number ♥ ♥ ♥
320 Generalized Abbreviation ♥ ♥
319 Bulb Switcher ♥ ♥
318 Maximum Product of Word Lengths ♥ ♥
317 Shortest Distance from All Buildings ♥ ♥ ♥
316 Remove Duplicate Letters ♥ ♥ ♥
315 Count of Smaller Numbers After Self ♥ ♥ ♥
314 Binary Tree Vertical Order Traversal ♥ ♥
Swift 313 Super Ugly Number ♥ ♥
312 Burst Balloons ♥ ♥ ♥
311 Sparse Matrix Multiplication ♥ ♥
310 Minimum Height Trees ♥ ♥
309 Best Time to Buy and Sell Stock with Cooldown ♥ ♥
308 Range Sum Query 2D - Mutable ♥ ♥ ♥
307 Range Sum Query - Mutable ♥ ♥
306 Additive Number ♥ ♥
305 Number of Islands II ♥ ♥ ♥
304 Range Sum Query 2D - Immutable ♥ ♥
303 Range Sum Query - Immutable
302 Smallest Rectangle Enclosing Black Pixels ♥ ♥ ♥
301 Remove Invalid Parentheses ♥ ♥ ♥
Swift 300 Longest Increasing Subsequence ♥ ♥
299 Bulls and Cows
298 Binary Tree Longest Consecutive Sequence ♥ ♥
297 Serialize and Deserialize Binary Tree ♥ ♥ ♥
296 Best Meeting Point ♥ ♥ ♥
295 Find Median from Data Stream ♥ ♥ ♥
294 Flip Game II ♥ ♥
Swift 293 Flip Game
292 Nim Game
291 Word Pattern II ♥ ♥ ♥
Swift 290 Word Pattern
289 Game of Life ♥ ♥
288 Unique Word Abbreviation
287 Find the Duplicate Number ♥ ♥ ♥
286 Walls and Gates ♥ ♥
285 Inorder Successor in BST ♥ ♥
284 Peeking Iterator ♥ ♥
Swift 283 Move Zeroes
282 Expression Add Operators ♥ ♥ ♥
281 Zigzag Iterator ♥ ♥
Swift 280 Wiggle Sort ♥ ♥
Swift 279 Perfect Squares ♥ ♥
278 First Bad Version
277 Find the Celebrity ♥ ♥
276 Paint Fence
275 H-Index II ♥ ♥
274 H-Index ♥ ♥
273 Integer to English Words ♥ ♥ ♥
272 Closest Binary Search Tree Value II ♥ ♥ ♥
271 Encode and Decode Strings ♥ ♥
Swift 270 Closest Binary Search Tree Value
269 Alien Dictionary ♥ ♥ ♥
268 Missing Number ♥ ♥
267 Palindrome Permutation II ♥ ♥
Swift 266 Palindrome Permutation
265 Paint House II ♥ ♥ ♥
Swift 264 Ugly Number II ♥ ♥
Swift 263 Ugly Number
261 Graph Valid Tree ♥ ♥
260 Single Number III ♥ ♥
259 3Sum Smaller ♥ ♥
258 Add Digits
257 Binary Tree Paths
256 Paint House ♥ ♥
255 Verify Preorder Sequence in Binary Search Tree ♥ ♥
254 Factor Combinations ♥ ♥
253 Meeting Rooms II ♥ ♥
Swift 252 Meeting Rooms
251 Flatten 2D Vector ♥ ♥
250 Count Univalue Subtrees ♥ ♥
249 Group Shifted Strings
248 Strobogrammatic Number III ♥ ♥ ♥
247 Strobogrammatic Number II ♥ ♥
246 Strobogrammatic Number
245 Shortest Word Distance III ♥ ♥
244 Shortest Word Distance II ♥ ♥
243 Shortest Word Distance
Swift 242 Valid Anagram
241 Different Ways to Add Parentheses ♥ ♥
240 Search a 2D Matrix II ♥ ♥
Swift 239 Sliding Window Maximum ♥ ♥ ♥
Swift 238 Product of Array Except Self ♥ ♥
237 Delete Node in a Linked List
236 Lowest Common Ancestor of a Binary Tree ♥ ♥
235 Lowest Common Ancestor of a Binary Search Tree
Swift 234 Palindrome Linked List
233 Number of Digit One ♥ ♥ ♥
232 Implement Queue using Stacks
Swift 231 Power of Two
230 Kth Smallest Element in a BST ♥ ♥
229 Majority Element II ♥ ♥
Swift 228 Summary Ranges ♥ ♥
227 Basic Calculator II ♥ ♥
Swift 226 Invert Binary Tree
225 Implement Stack using Queues
224 Basic Calculator ♥ ♥ ♥
223 Rectangle Area
222 Count Complete Tree Nodes ♥ ♥
Swift 221 Maximal Square ♥ ♥
220 Contains Duplicate III ♥ ♥
Swift 219 Contains Duplicate II
218 The Skyline Problem ♥ ♥ ♥
Swift 217 Contains Duplicate
Swift 216 Combination Sum III ♥ ♥
215 Kth Largest Element in an Array ♥ ♥
214 Shortest Palindrome ♥ ♥ ♥
Swift 213 House Robber II ♥ ♥
212 Word Search II ♥ ♥ ♥
211 Add and Search Word - Data structure design ♥ ♥
210 Course Schedule II ♥ ♥
209 Minimum Size Subarray Sum ♥ ♥
208 Implement Trie (Prefix Tree) ♥ ♥
207 Course Schedule ♥ ♥
Swift 206 Reverse Linked List
Swift 205 Isomorphic Strings
204 Count Primes
Swift 203 Remove Linked List Elements
Swift 202 Happy Number
201 Bitwise AND of Numbers Range ♥ ♥
Swift 200 Number of Islands ♥ ♥
199 Binary Tree Right Side View ♥ ♥
Swift 198 House Robber
191 Number of 1 Bits
190 Reverse Bits
Swift 189 Rotate Array
188 Best Time to Buy and Sell Stock IV ♥ ♥ ♥
187 Repeated DNA Sequences ♥ ♥
186 Reverse Words in a String II ♥ ♥
179 Largest Number ♥ ♥
174 Dungeon Game ♥ ♥ ♥
173 Binary Search Tree Iterator ♥ ♥
172 Factorial Trailing Zeroes
Swift 171 Excel Sheet Column Number
170 Two Sum III - Data structure design
169 Majority Element
168 Excel Sheet Column Title
167 Two Sum II - Input array is sorted ♥ ♥
166 Fraction to Recurring Decimal ♥ ♥
165 Compare Version Numbers
164 Maximum Gap ♥ ♥ ♥
163 Missing Ranges ♥ ♥
Swift 162 Find Peak Element ♥ ♥
Swift 161 One Edit Distance ♥ ♥
160 Intersection of Two Linked Lists
159 Longest Substring with At Most Two Distinct Characters ♥ ♥ ♥
158 Read N Characters Given Read4 II - Call multiple times ♥ ♥ ♥
157 Read N Characters Given Read4
156 Binary Tree Upside Down ♥ ♥
155 Min Stack
Swift 154 Find Minimum in Rotated Sorted Array II ♥ ♥ ♥
Swift 153 Find Minimum in Rotated Sorted Array ♥ ♥
Swift 152 Maximum Product Subarray ♥ ♥
151 Reverse Words in a String ♥ ♥
Swift 150 Evaluate Reverse Polish Notation ♥ ♥
149 Max Points on a Line ♥ ♥ ♥
148 Sort List ♥ ♥
147 Insertion Sort List ♥ ♥
146 LRU Cache ♥ ♥ ♥
Swift 145 Binary Tree Postorder Traversal ♥ ♥ ♥
Swift 144 Binary Tree Preorder Traversal ♥ ♥
Swift 143 Reorder List ♥ ♥
142 Linked List Cycle II ♥ ♥
141 Linked List Cycle
140 Word Break II ♥ ♥ ♥
139 Word Break ♥ ♥
138 Copy List with Random Pointer ♥ ♥ ♥
Swift 137 Single Number II ♥ ♥
Swift 136 Single Number ♥ ♥
135 Candy ♥ ♥ ♥
134 Gas Station ♥ ♥
133 Clone Graph ♥ ♥
132 Palindrome Partitioning II ♥ ♥ ♥
131 Palindrome Partitioning ♥ ♥
130 Surrounded Regions ♥ ♥
129 Sum Root to Leaf Numbers ♥ ♥
128 Longest Consecutive Sequence ♥ ♥ ♥
127 Word Ladder ♥ ♥
126 Word Ladder II ♥ ♥ ♥
125 Valid Palindrome
124 Binary Tree Maximum Path Sum ♥ ♥ ♥
123 Best Time to Buy and Sell Stock III ♥ ♥ ♥
122 Best Time to Buy and Sell Stock II ♥ ♥
Swift 121 Best Time to Buy and Sell Stock
120 Triangle ♥ ♥
119 Pascal's Triangle II
118 Pascal's Triangle
117 Populating Next Right Pointers in Each Node II ♥ ♥ ♥
116 Populating Next Right Pointers in Each Node ♥ ♥
115 Distinct Subsequences ♥ ♥ ♥
114 Flatten Binary Tree to Linked List ♥ ♥
Swift 113 Path Sum II ♥ ♥
Swift 112 Path Sum
Swift 111 Minimum Depth of Binary Tree
Swift 110 Balanced Binary Tree
109 Convert Sorted List to Binary Search Tree ♥ ♥
108 Convert Sorted Array to Binary Search Tree ♥ ♥
Swift 107 Binary Tree Level Order Traversal II
Swift 106 Construct Binary Tree from Inorder and Postorder Traversal ♥ ♥
Swift 105 Construct Binary Tree from Preorder and Inorder Traversal ♥ ♥
Swift 104 Maximum Depth of Binary Tree
Swift 103 Binary Tree Zigzag Level Order Traversal ♥ ♥
Swift 102 Binary Tree Level Order Traversal
Swift 101 Symmetric Tree
Swift 100 Same Tree
99 Recover Binary Search Tree ♥ ♥ ♥
Swift 98 Validate Binary Search Tree ♥ ♥
97 Interleaving String ♥ ♥ ♥
96 Unique Binary Search Trees ♥ ♥
95 Unique Binary Search Trees II ♥ ♥
Swift 94 Binary Tree Inorder Traversal ♥ ♥
93 Restore IP Addresses ♥ ♥
92 Reverse Linked List II ♥ ♥
91 Decode Ways ♥ ♥
Swift 90 Subsets II ♥ ♥
89 Gray Code ♥ ♥
88 Merge Sorted Array
87 Scramble String ♥ ♥ ♥
Swift 86 Partition List ♥ ♥
85 Maximal Rectangle ♥ ♥ ♥
84 Largest Rectangle in Histogram ♥ ♥ ♥
Swift 83 Remove Duplicates from Sorted List
Swift 82 Remove Duplicates from Sorted List II ♥ ♥
Swift 81 Search in Rotated Sorted Array II ♥ ♥
Swift 80 Remove Duplicates from Sorted Array II ♥ ♥
Swift 79 Word Search ♥ ♥
Swfit 78 Subsets ♥ ♥
Swift 77 Combinations ♥ ♥
76 Minimum Window Substring ♥ ♥ ♥
Swift 75 Sort Colors ♥ ♥
74 Search a 2D Matrix ♥ ♥
73 Set Matrix Zeroes ♥ ♥
Swift 72 Edit Distance ♥ ♥ ♥
Swift 71 Simplify Path ♥ ♥
Swift 70 Climbing Stairs
Swift 69 Sqrt(x) ♥ ♥
Swift 68 Text Justification ♥ ♥ ♥
Swift 67 Add Binary
Swift 66 Plus One
65 Valid Number ♥ ♥ ♥
64 Minimum Path Sum ♥ ♥
Swift 63 Unique Paths II ♥ ♥
Swift 62 Unique Paths ♥ ♥
Swift 61 Rotate List ♥ ♥
60 Permutation Sequence ♥ ♥
Swift 59 Spiral Matrix II ♥ ♥
Swift 58 Length of Last Word
57 Insert Interval ♥ ♥ ♥
Swift 56 Merge Intervals ♥ ♥ ♥
55 Jump Game ♥ ♥
Swift 54 Spiral Matrix ♥ ♥
Swift 53 Maximum Subarray ♥ ♥
52 N-Queens II ♥ ♥ ♥
51 N-Queens ♥ ♥ ♥
Swift 50 "Pow(x, n)" ♥ ♥
Swift 49 Group Anagrams ♥ ♥
Swift 48 Rotate Image ♥ ♥
Swift 47 Permutations II ♥ ♥
Swift 46 Permutations ♥ ♥
45 Jump Game II ♥ ♥ ♥
44 Wildcard Matching ♥ ♥ ♥
43 Multiply Strings ♥ ♥
Swift 42 Trapping Rain Water ♥ ♥ ♥
41 First Missing Positive ♥ ♥ ♥
Swift 40 Combination Sum II ♥ ♥
Swift 39 Combination Sum ♥ ♥
Swift 38 Count and Say
37 Sudoku Solver ♥ ♥ ♥
Swift 36 Valid Sudoku
Swift 35 Search Insert Position ♥ ♥
Swift 34 Search for a Range ♥ ♥
Swift 33 Search in Rotated Sorted Array ♥ ♥ ♥
32 Longest Valid Parentheses ♥ ♥ ♥
31 Next Permutation ♥ ♥
30 Substring with Concatenation of All Words ♥ ♥ ♥
29 Divide Two Integers ♥ ♥
Swift 28 Implement strStr()
Swfit 27 Remove Element
Swift 26 Remove Duplicates from Sorted Array
25 Reverse Nodes in k-Group ♥ ♥ ♥
Swift 24 Swap Nodes in Pairs
Swift 23 Merge k Sorted Lists ♥ ♥ ♥
Swift 22 Generate Parentheses ♥ ♥
Swift 21 Merge Two Sorted Lists
Swift 20 Valid Parentheses
Swift 19 Remove Nth Node From End of List
Swift 18 4Sum ♥ ♥
Swift 17 Letter Combinations of a Phone Number ♥ ♥
16 3Sum Closest ♥ ♥
Swift 15 3Sum ♥ ♥
Swift 14 Longest Common Prefix
Swift 13 Roman to Integer
12 Integer to Roman ♥ ♥
11 Container With Most Water ♥ ♥
10 Regular Expression Matching ♥ ♥ ♥
Swift 9 Palindrome Number
Swift 8 String to Integer (atoi)
Swift 7 Reverse Integer
Swift 6 ZigZag Conversion
Swift 5 Longest Palindromic Substring ♥ ♥
Swift 4 Median of Two Sorted Arrays ♥ ♥ ♥
Swift 3 Longest Substring Without Repeating Characters ♥ ♥
Swift 2 Add Two Numbers ♥ ♥
Swift 1 Two Sum

About

Solutions coded by Swift to LeetCode

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 100.0%