Skip to content

bofeizhu/LeetCode-Swift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode-Swift

LeetCode Swift Solutions

Main Features
💯 All the solutions have been accepted by the judge of LeetCode.com
🎯 Each playground comes with a suite of unit tests.
🐥 Written in Swift 4.2
💎 Follow Google's Swift Style Guide
🔍 ⌘ + F to search problem name or problem # in README

List of Companies

You can visit the pages below to search problems by company tags. Then come back and use ⌘ + F to search by problem name or problem #. (LeetCode subscription is required to visit these pages)

List of Problems & Solutions

# Problem Solution Approach
1 Two Sum Solution Dictionary
2 Add Two Numbers Solution Elementary math
3 Longest Substring Without Repeating Characters Solution Sliding Window with Dictionary
4 Median of Two Sorted Arrays Solution Recursive & Binary search
5 Longest Palindromic Substring Solution Manacher’s algorithm
6 ZigZag Conversion Solution Visit by Row
7 Reverse Integer Solution Pop and Push Digits
8 String to Integer (atoi) Solution Iteration
9 Palindrome Number Solution Revert half of the number
10 Regular Expression Matching Solution Dynamic Programming
11 Container With Most Water Solution Two Pointers
12 Integer to Roman Solution Iteration
13 Roman to Integer Solution Iteration
14 Longest Common Prefix Solution Vertical scanning
15 Three Sum Solution Two Pointers
16 Three Sum Closest Solution Two Pointers
17 Letter Combinations of a Phone Number Solution Backtracking
18 Four Sum Solution Two Pointers
19 Remove Nth Node From End of List * Solution Two Pointers
20 Valid Parentheses Solution Stack
21 Merge Two Sorted Lists Solution Iteration
22 Generate Parentheses Solution Backtracking
23 Merge k Sorted Lists Solution Divide And Conquer
24 Swap Nodes in Pairs Solution Iteration
25 Reverse Nodes in k-Group * Solution Two Pointers
26 Remove Duplicates from Sorted Array Solution Two Pointers
27 Remove Element Solution Two Pointers
28 Implement strStr() Solution String
29 Divide Two Integers Solution String
30 Substring with Concatenation of All Words Solution Two Pointers
31 Next Permutation Solution Two Pointers
32 Longest Valid Parentheses Solution Stack
33 Search in Rotated Sorted Array Solution Binary Search
66 Plus One Solution Math
84 Largest Rectangle in Histogram Solution Stack
159 Longest Substring with At Most Two Distinct Characters Solution Two Pointers
163 Missing Ranges Solution Iteration
200 Number of Islands Solution BFS
205 Isomorphic Strings Solution Dictionary
259 Three Sum Smaller Solution Two Pointers
280 Wiggle Sort Solution Swap
298 Binary Tree Longest Consecutive Sequence Solution DFS
403 Frog Jump Solution Dynamic Programming
482 License Key Formatting Solution String
681 Next Closest Time Solution Simulation
683 K Empty Slots Solution Sliding Window
686 Repeated String Match Solution String
734 Sentence Similarity * Solution Dictionary
737 Sentence Similarity II * Solution Union Find
766 Toeplitz Matrix Solution Top-Left Neighbor
803 Bricks Falling When Hit Solution Union Find
843 Guess the Word * Solution Minimax

* problems are not compilable on LeetCode. I have filed bug report for these problems.

About

Accepted LeetCode solutions written in Swift 4.2

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages