Skip to content

Commit 1e91a92

Browse files
committed
update folder structure
1 parent ce4c3ad commit 1e91a92

30 files changed

+39
-27
lines changed

README.md

+27-27
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@ LeetCode
33

44
| # | No. | Title | C++ | Python | Topics | Difficulty | Date |
55
|:----:|:------:| :--------------: | :--------: | :--------: | :--------: | :-: | :------: |
6-
| 1 |0101|[Symmetric Tree](https://leetcode.com/problems/symmetric-tree/) | c++ | [python](./solution/101-Symmetric-Tree/SymmetricTree.py) | bfs | E | 2019/04/09 |
7-
| 2 |0279|[Perfect Squares](https://leetcode.com/problems/perfect-squares/) | c++ | [python](./solution/279-Perfect-Squares/PerfectSquares.py) | bfs | M | 2019/04/09 |
8-
| 3 |0062|[Unique Paths](https://leetcode.com/problemset/all/) | c++ | [python](./solution/62-Unique-Paths/UniquePaths.py) | dp | M | 2019/04/15 |
9-
| 4 |0063|[Unique Paths II](https://leetcode.com/problemset/all/) | c++ | [python](./solution/63-Unique-PathsII/UniquePathsII.py) | dp | M | 2019/04/15 |
10-
| 5 |0980|[Unique Paths III](https://leetcode.com/problemset/all/) | c++ | [python](./solution/980-Unique-Paths-III/UniquePathsIII.py) | dfs+backtracking | H | 2019/04/15 |
11-
| 6 |0005|[Longest Palindromic Substring](https://leetcode.com/problemset/all/) | c++ | [python](./solution/5-Longest-Palindromic-Substring/LongestPalindromicSubstring.py) | dp/expand around center | M | 2019/04/15 |
12-
| 7 |0300|[Longest Increasing Subsequence](https://leetcode.com/problemset/all/) | c++ | [python](./solution/300-Longest-Increasing-Subsequence/LongestIncreasingSubsequence.py) | dp/dp with binarysearch | M | 2019/04/16 |
13-
| 8 |0191|[Number of 1 Bits](https://leetcode.com/problemset/all/) | c++ | [python](./solution/191-Number-of-1-Bits/Numberof1Bits.py) | bit manipulation | E | 2019/04/16 |
14-
| 9 |0338|[Counting Bits](https://leetcode.com/problemset/all/) | c++ | [python](./solution/338-Counting-Bits/CountingBits.py) | brute force/dp| M | 2019/04/16 |
15-
| 10 |0064|[Minimum Path Sum](https://leetcode.com/problemset/all/) | c++ | [python](./solution/64-Minimum-Path-Sum/MinimumPathSum.py) | dp | M | 2019/04/16 |
16-
| 11 |0174|[Dungeon Game](https://leetcode.com/problemset/all/) | c++ | [python](./solution/174-Dungeon-Game/DungeonGame.py) | dp | H | 2019/04/17 |
17-
| 12 |0121|[Best Time to Buy and Sell Stock](https://leetcode.com/problemset/all/) | c++ | [python](./solution/121-Best-Time-to-Buy-and-Sell-Stock/BestTimetoBuyandSellStock.py) | dp | E | 2019/04/17 |
18-
| 13 |0122|[Best Time to Buy and Sell Stock II](https://leetcode.com/problemset/all/) | c++ | [python](./solution/121-Best-Time-to-Buy-and-Sell-Stock-II/BestTimetoBuyandSellStockII.py) | greedy | E | 2019/04/17 |
19-
| 14 |0123|[Best Time to Buy and Sell Stock III](https://leetcode.com/problemset/all/) | c++ | [python](./solution/123-Best-Time-to-Buy-and-Sell-Stock-III/BestTimetoBuyandSellStockIII.py) | dp | H | 2019/04/18 |
20-
| 15 |0188|[Best Time to Buy and Sell Stock IV](https://leetcode.com/problemset/all/) | c++ | [python](./solution/188-Best-Time-to-Buy-and-Sell-Stock-IV/BestTimetoBuyandSellStockIV.py) | dp | H | 2019/04/18 |
21-
| 16 |0096|[Unique Binary Search Trees](https://leetcode.com/problemset/all/) | c++ | [python](./solution/96-Unique-Binary-Search-Trees/UniqueBinarySearchTrees.py) | dp | M | 2019/04/19 |
22-
| 17 |0095|[Unique Binary Search Trees II](https://leetcode.com/problemset/all/) | c++ | [python](./solution/95-Unique-Binary-Search-Trees-II/UniqueBinarySearchTreesII.py) | dfs/dp | M | 2019/04/19 |
23-
| 18 |0120|[Triangle](https://leetcode.com/problemset/all/) | c++ | [python](./solution/120-Triangle/Triangle.py) | dp | M | 2019/04/22 |
24-
| 19 |0098|[Validate Binary Search Tree](https://leetcode.com/problemset/all/) | c++ | [python](./solution/98-Validate-Binary-Search-Tree/ValidateBinarySearchTree.py) | dfs | M | 2019/04/22 |
25-
| 20 |0099|[Recover Binary Search Tree](https://leetcode.com/problemset/all/) | c++ | [python](./solution/99-Recover-Binary-Search-Tree/RecoverBinarySearchTree.py) | dfs | H | 2019/04/24 |
26-
| 21 |0100|[Same Tree](https://leetcode.com/problemset/all/) | c++ | [python](./solution/100-Same-Tree/SameTree.py) | dfs | E | 2019/04/24 |
27-
| 22 |0104|[Maximum Depth of Binary Tree](https://leetcode.com/problemset/all/) | c++ | [python](./solution/104-Maximum-Depth-of-Binary-Tree/MaximumDepthofBinaryTree.py) | dfs/bfs | E | 2019/04/25 |
28-
| 23 |0105|[Construct Binary Tree from Preorder and Inorder Traversal](https://leetcode.com/problemset/all/) | c++ | [python](./solution/105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal/ConstructBinaryTreefromPreorderandInorderTraversal.py) | dfs | M | 2019/04/25 |
29-
| 24 |0106|[Construct Binary Tree from Inorder and Postorder Traversal](https://leetcode.com/problemset/all/) | c++ | [python](./solution/106-Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal/ConstructBinaryTreefromInorderandPostorderTraversal.py) | dfs | M | 2019/04/26 |
30-
| 25 |0153|[Find Minimum in Rotated Sorted Array](https://leetcode.com/problemset/all/) | c++ | [python](./solution/153-Find-Minimum-in-Rotated-Sorted-Array/FindMinimuminRotatedSortedArray.py) | binary search | M | 2019/04/28 |
31-
| 26 |0072|[Edit Distance](https://leetcode.com/problemset/all/) | c++ | [python](./solution/72-Edit-Distance/EditDistance.py) | dp | H | 2019/05/21 |
32-
| 27 |1190|[Reverse Substrings Between Each Pair of Parentheses](https://leetcode.com/problemset/all/) | c++ | [python](./solution/1190-Reverse-Substrings-Between-Each-Pair-of-Parentheses/ReverseSubstringsBetweenEachPairofParentheses.py) | stack | M | 2019/09/17 |
6+
| 1 |101|[Symmetric Tree](https://leetcode.com/problems/symmetric-tree/) | c++ | [python](./solution/101SymmetricTree.py) | bfs | E | 2019/04/09 |
7+
| 2 |279|[Perfect Squares](https://leetcode.com/problems/perfect-squares/) | c++ | [python](./solution/279PerfectSquares.py) | bfs | M | 2019/04/09 |
8+
| 3 |62|[Unique Paths](https://leetcode.com/problemset/all/) | c++ | [python](./solution/62UniquePaths.py) | dp | M | 2019/04/15 |
9+
| 4 |63|[Unique Paths II](https://leetcode.com/problemset/all/) | c++ | [python](./solution/63UniquePathsII.py) | dp | M | 2019/04/15 |
10+
| 5 |980|[Unique Paths III](https://leetcode.com/problemset/all/) | c++ | [python](./solution/980UniquePathsIII.py) | dfs+backtracking | H | 2019/04/15 |
11+
| 6 |5|[Longest Palindromic Substring](https://leetcode.com/problemset/all/) | c++ | [python](./solution/5LongestPalindromicSubstring.py) | dp/expand around center | M | 2019/04/15 |
12+
| 7 |300|[Longest Increasing Subsequence](https://leetcode.com/problemset/all/) | c++ | [python](./solution/300LongestIncreasingSubsequence.py) | dp/dp with binarysearch | M | 2019/04/16 |
13+
| 8 |191|[Number of 1 Bits](https://leetcode.com/problemset/all/) | c++ | [python](./solution/191Numberof1Bits.py) | bit manipulation | E | 2019/04/16 |
14+
| 9 |338|[Counting Bits](https://leetcode.com/problemset/all/) | c++ | [python](./solution/338CountingBits.py) | brute force/dp| M | 2019/04/16 |
15+
| 10 |64|[Minimum Path Sum](https://leetcode.com/problemset/all/) | c++ | [python](./solution/64MinimumPathSum.py) | dp | M | 2019/04/16 |
16+
| 11 |174|[Dungeon Game](https://leetcode.com/problemset/all/) | c++ | [python](./solution/174DungeonGame.py) | dp | H | 2019/04/17 |
17+
| 12 |121|[Best Time to Buy and Sell Stock](https://leetcode.com/problemset/all/) | c++ | [python](./solution/121BestTimetoBuyandSellStock.py) | dp | E | 2019/04/17 |
18+
| 13 |122|[Best Time to Buy and Sell Stock II](https://leetcode.com/problemset/all/) | c++ | [python](./solution/122BestTimetoBuyandSellStockII.py) | greedy | E | 2019/04/17 |
19+
| 14 |123|[Best Time to Buy and Sell Stock III](https://leetcode.com/problemset/all/) | c++ | [python](./solution/123BestTimetoBuyandSellStockIII.py) | dp | H | 2019/04/18 |
20+
| 15 |188|[Best Time to Buy and Sell Stock IV](https://leetcode.com/problemset/all/) | c++ | [python](./solution/188BestTimetoBuyandSellStockIV.py) | dp | H | 2019/04/18 |
21+
| 16 |96|[Unique Binary Search Trees](https://leetcode.com/problemset/all/) | c++ | [python](./solution/96UniqueBinarySearchTrees.py) | dp | M | 2019/04/19 |
22+
| 17 |95|[Unique Binary Search Trees II](https://leetcode.com/problemset/all/) | c++ | [python](./solution/95UniqueBinarySearchTreesII.py) | dfs/dp | M | 2019/04/19 |
23+
| 18 |120|[Triangle](https://leetcode.com/problemset/all/) | c++ | [python](./solution/120Triangle.py) | dp | M | 2019/04/22 |
24+
| 19 |98|[Validate Binary Search Tree](https://leetcode.com/problemset/all/) | c++ | [python](./solution/98ValidateBinarySearchTree.py) | dfs | M | 2019/04/22 |
25+
| 20 |99|[Recover Binary Search Tree](https://leetcode.com/problemset/all/) | c++ | [python](./solution/99RecoverBinarySearchTree.py) | dfs | H | 2019/04/24 |
26+
| 21 |100|[Same Tree](https://leetcode.com/problemset/all/) | c++ | [python](./solution/100SameTree.py) | dfs | E | 2019/04/24 |
27+
| 22 |104|[Maximum Depth of Binary Tree](https://leetcode.com/problemset/all/) | c++ | [python](./solution/104MaximumDepthofBinaryTree.py) | dfs/bfs | E | 2019/04/25 |
28+
| 23 |105|[Construct Binary Tree from Preorder and Inorder Traversal](https://leetcode.com/problemset/all/) | c++ | [python](./solution/105ConstructBinaryTreefromPreorderandInorderTraversal.py) | dfs | M | 2019/04/25 |
29+
| 24 |106|[Construct Binary Tree from Inorder and Postorder Traversal](https://leetcode.com/problemset/all/) | c++ | [python](./solution/106ConstructBinaryTreefromInorderandPostorderTraversal.py) | dfs | M | 2019/04/26 |
30+
| 25 |153|[Find Minimum in Rotated Sorted Array](https://leetcode.com/problemset/all/) | c++ | [python](./solution/153FindMinimuminRotatedSortedArray.py) | binary search | M | 2019/04/28 |
31+
| 26 |72|[Edit Distance](https://leetcode.com/problemset/all/) | c++ | [python](./solution/72EditDistance.py) | dp | H | 2019/05/21 |
32+
| 27 |1190|[Reverse Substrings Between Each Pair of Parentheses](https://leetcode.com/problemset/all/) | c++ | [python](./solution/1190ReverseSubstringsBetweenEachPairofParentheses.py) | stack | M | 2019/09/17 |
3333

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution:
2+
def isMatch(self, s: str, p: str) -> bool:
3+
m = len(s)
4+
n = len(p)
5+
dp = [False *(n+1) for _ in range(m+1)]
6+
# dp[i][j] =
7+
# dp[i-1][j-1] 如果 i > 0 , 并且 p[j-1] == '.' or s[i-1] == p[j-1]
8+
# dp[i][j-2] (表示不用 *x ) or ( dp[i-1][j] and (s[i-1] == p[j-1] or p[j-2] == '.') )
9+
# if p[j-1] == '*'
10+
for i in range(m+1):
11+
for j in range(n+1):
12+
dp[][]
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)