LeetCode上的题目都是面试中常遇到的,涉及到一些很基础的算法,也不像ACM。
以下是我做过的LeetCode上的题目。不断更新==
有可能由于个人读题跑偏而使代码虽然AC,但是不符合题目的要求,比如用常数内存啥的。欢迎指正。
每个汇总20题。实现代码为C++/python
- Triangle
- Gray Code
- Maximum Depth of Binary Tree
- Add Two Numbers
- Merge Sorted Array
- First Missing Positive
- Binary Tree Level Order Traversal
- Add Binary
- Pascals Triangle
- Merge k Sorted Lists
- Candy
- Sum
- Single Number
- Remove Nth Node From End of List
- ZigZag Conversion
- Rotate Image
- Merge Two Sorted Lists
- Text Justification
- Reverse Words in a String
- Evaluate Reverse Polish Notation
- Jump Game II
- Combinations
- Swap Nodes in Pairs
- Remove Duplicates from Sorted List
- Two Sum
- Path Sum
- Path Sum II
- Single Number II
- Jump Game
- Combination Sum II
- Combination Sum
- Remove Duplicates from Sorted Array
- Remove Element
- Remove Duplicates from Sorted Array II
- Unique Paths
- Unique Paths II
- Binary Tree Preorder Traversal
- Binary Tree Postorder Traversal
- Surrounded Regions
- Word Search
- Climbing Stairs
- Longest Substring Without Repeating Characters
- Reverse Integer
- N-Queens
- Largest Rectangle in Histogram
- Valid Palindrome
- Longest Valid Parentheses
- Merge Intervals
- Divide Two Integers
- Palindrome Number
- Valid Parentheses
- Spiral Matrix II
- Spiral Matrix
- Search a 2D Matrix
- Binary Tree Inorder Traversal
- Maximum Subarray
- Minimum Depth of Binary Tree
- Integer to Roman
- Sort Colors
- Remove Duplicates from Sorted List II
- Permutations
- Length of Last Word
- Linked List Cycle
- Maximal Rectangle
- Linked List Cycle II
- Longest Common Prefix
- Binary Tree Maximum Path Sum
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock II
- Best Time to Buy and Sell Stock III
- Linked List Cycle
- Search in Rotated Sorted Array
- Container With Most Water
- Unique Binary Search Trees
- Insertion Sort List
- First Missing Positive
- Sum Root to Leaf Numbers
- Set Matrix Zeroes
- Restore IP Addresses
- Search Insert Position