[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 is strictly follow RayWenderlich Swift Style Guide. Please feel free to reference and STAR to support this repo, thank you!
Title | Solution | Difficulty |
---|---|---|
Contains Duplicate | Swift | Easy |
Contains Duplicate II | Swift | Easy |
Remove Duplicates from Sorted Array | Swift | Easy |
Remove Duplicates from Sorted Array II | Swift | Medium |
Move Zeroes | Swift | Easy |
Remove Element | Swift | Easy |
Rotate Array | Swift | Easy |
Two Sum | Swift | Easy |
3Sum | Swift | Medium |
Maximum Size Subarray Sum Equals k | Swift | Easy |
Product of Array Except Self | Swift | Medium |
Spiral Matrix | Swift | Medium |
Title | Solution | Difficulty |
---|---|---|
Count and Say | Swift | Easy |
Flip Game | Swift | Easy |
Implement strStr() | Swift | Easy |
Reverse String | Swift | Easy |
Reverse Vowels of a String | Swift | Easy |
Length of Last Word | Swift | Easy |
Valid Anagram | Swift | Easy |
Group Anagrams | Swift | Medium |
Longest Common Prefix | Swift | Easy |
Longest Substring Without Repeating Characters | Swift | Medium |
One Edit Distance | Swift | Medium |
Word Pattern | Swift | Easy |
Title | Solution | Difficulty |
---|---|---|
Reverse Linked List | Swift | Easy |
Palindrome Linked List | Swift | Easy |
Swap Nodes in Pairs | Swift | Easy |
Remove Linked List Elements | Swift | Easy |
Remove Duplicates from Sorted List | Swift | Easy |
Remove Duplicates from Sorted List II | Swift | Medium |
Remove Nth Node From End of List | Swift | Easy |
Rotate List | Swift | Medium |
Reorder List | Swift | Medium |
Merge Two Sorted Lists | Swift | Easy |
Merge k Sorted Lists | Swift | Hard |
Partition List | Swift | Medium |
Title | Solution | Difficulty |
---|---|---|
Valid Parentheses | Swift | Easy |
Evaluate Reverse Polish Notation | Swift | Medium |
Simplify Path | Swift | Medium |
Binary Tree Preorder Traversal | Swift | Medium |
Binary Tree Inorder Traversal | Swift | Medium |
Binary Tree Postorder Traversal | Swift | Hard |
Title | Solution | Difficulty |
---|---|---|
Same Tree | Swift | Easy |
Symmetric Tree | Swift | Easy |
Invert Binary Tree | Swift | Easy |
Minimum Depth of Binary Tree | Swift | Easy |
Maximum Depth of Binary Tree | Swift | Easy |
Balanced Binary Tree | Swift | Easy |
Binary Tree Level Order Traversal | Swift | Easy |
Binary Tree Level Order Traversal II | Swift | Easy |
Binary Tree Zigzag Level Order Traversal | Swift | Medium |
Path Sum | Swift | Easy |
Path Sum II | Swift | Medium |
Title | Solution | Difficulty |
---|---|---|
Nested List Weight Sum | Swift | Easy |
Climbing Stairs | Swift | Easy |
Unique Paths | Swift | Medium |
Unique Paths II | Swift | Medium |
Coin Change | Swift | Medium |
Longest Increasing Subsequence | Swift | Medium |
House Robber | Swift | Easy |
House Robber II | Swift | Medium |
Maximum Subarray | Swift | Medium |
Maximum Product Subarray | Swift | Medium |
Maximal Square | Swift | Medium |
Edit Distance | Swift | Hard |
Title | Solution | Difficulty |
---|---|---|
Permutations | Swift | Medium |
Permutations II | Swift | Medium |
Subsets | Swift | Medium |
Subsets II | Swift | Medium |
Combinations | Swift | Medium |
Combination Sum | Swift | Medium |
Combination Sum II | Swift | Medium |
Combination Sum III | Swift | Medium |
Letter Combinations of a Phone Number | Swift | Medium |
Number of Islands | Swift | Medium |
Word Search | Swift | Medium |
Title | Solution | Difficulty |
---|---|---|
Add Binary | Swift | Easy |
Add Two Numbers | Swift | Medium |
Integer Break | Swift | Medium |
Happy Number | Swift | Easy |
Single Number | Swift | Medium |
Ugly Number | Swift | Easy |
String to Integer (atoi) | Swift | Easy |
Excel Sheet Column Number | Swift | Easy |
Title | Solution | Difficulty |
---|---|---|
Closest Binary Search Tree Value | Swift | Easy |
Search in Rotated Sorted Array | Swift | Hard |
Search in Rotated Sorted Array II | Swift | Medium |
Find Peak Element | Swift | Medium |
Sqrt(x) | Swift | Medium |
Title | Solution | Difficulty |
---|---|---|
Sort Colors | Swift | Medium |
Top K Frequent Elements | Swift | Medium |
Meeting Rooms | Swift | Easy |
Merge Intervals | Swift | Hard |