/leetcode

一个渣渣前端的LeetCode的刷题库

Primary LanguagePythonMIT LicenseMIT

Letcode

关于这个仓库

  1. readme的格式以及部分答案参考 kamyu104
  2. 部分解法来自社区
  3. 短期内在使用python3在进行刷题

算法

Hash

# Title Solution Time Space Difficulty Tag Note
001 Two Sum Python O(n) O(n) Easy
003 Longest Substring Without Repeating Characters Python O(n) O(1) Medium
036 Valid Sudoku Python O(9^2) O(9) Easy

String

# Title Solution Time Space Difficulty Tag Note
006 ZigZag Conversion Python O(n) O(1) Easy
028 Implement strStr() Python O(n + k) O(k) Easy

Array

# Title Solution Time Space Difficulty Tag Note
015 3 Sum Python O(n^2) O(1) Medium Two Pointers
016 3 Sum Closest Python O(n^2) O(1) Medium Two Pointers
018 4 Sum Python O(n^3) O(1) Medium Two Pointers
027 Remove Element Python O(n) O(1) Easy
031 Next Permutation Python O(n) O(1) Medium
118 Pascal's Triangle Python O(n^2) O(1) Easy

Bit Manipulation

# Title Solution Time Space Difficulty Tag Note
190 Reverse Bits Python O(1) O(1) Easy
191 Number of 1 Bits Python O(1) O(1) Easy
201 Bitwise AND of Numbers Range Python O(1) O(1) Medium

Linked List

# Title Solution Time Space Difficulty Tag Note
002 Add Two Numbers Python O(n) O(1) Medium

Math

# Title Solution Time Space Difficulty Tag Note
007 Reverse Integer Python O(1) O(1) Easy
029 Divide Two Integers Python O(1) O(1) Medium

Greedy

# Title Solution Time Space Difficulty Tag Note
011 Container With Most Water Python O(n) O(1) Medium

Backtracking

# Title Solution Time Space Difficulty Tag Note
017 Letter Combinations of a Phone Number Python O(n*n) O(n) Medium
022 Generate Parentheses Python O(4^n / n^(3/2)) O(n) Medium

Stack

# Title Solution Time Space Difficulty Tag Note
020 Valid Parentheses Python O(n) O(n) Easy

Binary Search

# Title Solution Time Space Difficulty Tag Note
033 Search in Rotated Sorted Array Python O(logn) O(1) Hard
# Title Solution Difficulty
26 Remove Duplicates from Sorted Array JavaScript Easy
7 Reverse Integer JavaScript Easy
4 Median of Two Sorted Arrays JavaScript Hard
1 Two Sum JavaScript Easy