Introduction
Complete solutions to LeetCode, LCOF and LCCI problems, updated daily. Please give me a star
Sites
- Gitee Pages: https://doocs.gitee.io/leetcode
- GitHub Pages: https://doocs.github.io/leetcode
Solutions
Basic Algorithms
Sorting
- Bubble Sort
- Insertion Sort
- Selection Sort
- Merge Sort(Algorithm Template)
- Quick Sort(Algorithm Template)
- Shell Sort
- Heap Sort(Algorithm Template)
Searching
High Frequency Interview Questions
Arrays
- Majority Element
- Remove Duplicates from Sorted Array
- Remove Duplicates from Sorted Array II
- Remove Element
- Move Zeroes
- Rotate Array
- Spiral Matrix
- Two Sum
- 3Sum
- 4Sum
- 3Sum Smaller
- 3Sum Closest
- Merge Sorted Array
- Find Minimum in Rotated Sorted Array
- Find Minimum in Rotated Sorted Array II
- Product of Array Except Self
Strings
- Longest Substring Without Repeating Characters
- Longest Common Prefix
- Reverse Vowels of a String
- String to Integer (atoi)
- Ransom Note
Linked List
- Add Two Numbers
- Add Two Numbers II
- Delete Node in a Linked List
- Remove Duplicates from Sorted List
- Remove Duplicates from Sorted List II
- Remove Linked List Elements
- Kth Node From End of List
- Swap Nodes in Pairs
- Merge Two Sorted Lists
- Merge k Sorted Lists
- Insertion Sort List
- Sort List
- Reverse Linked List
- Reverse Linked List II
- Reorder List
- Rotate List
- Palindrome Linked List
- Intersection of Two Linked Lists
- Odd Even Linked List
- Linked List Cycle
- Linked List Cycle II
- Design Linked List
Binary Tree
- Binary Tree Preorder Traversal
- Binary Tree Postorder Traversal
- Binary Tree Inorder Traversal
- Symmetric Tree
- Invert Binary Tree
- Binary Tree Level Order Traversal
- Binary Tree Level Order Traversal II
- Binary Tree Right Side View
- Maximum Depth of Binary Tree
- Minimum Depth of Binary Tree
- Binary Tree Paths
- Path Sum
- Path Sum II
- Construct Binary Tree from Preorder and Inorder Traversal
- Construct Binary Tree from Inorder and Postorder Traversal
- Binary Search Tree Iterator
- Lowest Common Ancestor of a Binary Tree
- Lowest Common Ancestor of a Binary Search Tree
- BiNode
- Convert Binary Search Tree to Sorted Doubly Linked List
- Boundary of Binary Tree
- Populating Next Right Pointers in Each Node
- Populating Next Right Pointers in Each Node II
Math
- Integer to Roman
- Roman to Integer
- Single Number
- Single Number II
- Single Number III
- Set Mismatch
- Number of 1 Bits
- Count Primes
- Missing Number
Stack & Queue
- Valid Parentheses
- Min Stack
- Implement Queue using Stacks
- Implement Stack using Queues
- Evaluate Reverse Polish Notation
- Number of Recent Calls
- Daily Temperatures
- Basic Calculator II
- Next Greater Element I
- Next Greater Element II
Dynamic Programming
- Fibonacci Number
- N-th Tribonacci Number
- Climbing Stairs
- Min Cost Climbing Stairs
- House Robber
- House Robber II
- Delete and Earn
- Jump Game
- Jump Game II
- Maximum Subarray
- Maximum Sum Circular Subarray
- Maximum Product Subarray
- Maximum Length of Subarray With Positive Product
- Best Sightseeing Pair
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock II
- Best Time to Buy and Sell Stock III
- Best Time to Buy and Sell Stock with Cooldown
- Best Time to Buy and Sell Stock with Transaction Fee
- Word Break
- Trapping Rain Water
- Arithmetic Slices
- Decode Ways
- Unique Binary Search Trees
- Ugly Number II
- Pascal's Triangle
- Pascal's Triangle II
- Minimum Falling Path Sum
- Triangle
- Matrix Block Sum
- Range Sum Query 2D - Immutable
- Unique Paths
- Unique Paths II
- Minimum Path Sum
- Longest Palindromic Substring
- Longest Palindromic Subsequence
- Longest Increasing Subsequence
- Wiggle Subsequence
- Longest Common Subsequence
- Edit Distance
- Coin Change
- Coin Change 2
- Combination Sum IV
- Integer Break
- Perfect Squares
- Russian Doll Envelopes
Backtracking
Union Find
Design
- LRU Cache
- Implement Trie (Prefix Tree)
- Implement Trie II (Prefix Tree)
- Design Circular Queue
- Design Circular Deque
- Design HashSet
- Design HashMap
Maintainers
Contributions
I'm looking for long-term contributors/partners to this repo! Send me PRs if you're interested! See the following:
- Fork this repository to your own GitHub account and then clone it to your local machine.
- Make some changes to your leetcode repository, then push the changes to your remote GitHub repository.
- Create a pull request with your changes!
- See CONTRIBUTING or GitHub Help for more details.
You can also contribute to doocs/leetcode using Gitpod.io, a free online dev environment with a single click.
Stargazers over time
Contributors
This project exists thanks to all the people who contribute.
Backers & Sponsors
Thank you to all our backers and sponsors!
"You help the developer community practice for interviews, and there is nothing better we could ask for." -- Alan Yessenbayev
License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.