Skip to content

Commit fdafccd

Browse files
committed
add back tracking
1 parent b9c9dec commit fdafccd

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Permutations (全排列)
2+
3+
LeetCode 46
4+
5+
- [英文版](https://leetcode.com/problems/permutations/)
6+
7+
- [中文版](https://leetcode-cn.com/problems/permutations/)
8+
9+
## 题目
10+
给定一个没有重复数字的序列,返回其所有可能的全排列。
11+
12+
示例:
13+
```
14+
输入: [1,2,3]
15+
输出:
16+
[
17+
[1,2,3],
18+
[1,3,2],
19+
[2,1,3],
20+
[2,3,1],
21+
[3,1,2],
22+
[3,2,1]
23+
]
24+
```
25+
## 思路
26+
<details>
27+
<summary>点击展开</summary>
28+
// TODO
29+
</details>
30+
31+
## 代码实现
32+
| C | C++ | Java | Objective-C | Swift | Python | JavaScript | Go | PHP |
33+
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
34+
| 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 |
35+
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Regular Expression Matching(正则表达式匹配)
2+
3+
LeetCode 10
4+
5+
- [英文版]()
6+
7+
- [中文版](https://leetcode-cn.com/problems/regular-expression-matching/)
8+
9+
## 题目
10+
给定一个字符串 (s) 和一个字符模式 (p)。实现支持 `'.'``'*'` 的正则表达式匹配。
11+
```
12+
- '.' 匹配任意单个字符。
13+
- '*' 匹配零个或多个前面的元素。
14+
```
15+
16+
匹配应该覆盖整个字符串 (s) ,而不是部分字符串。
17+
18+
说明:
19+
20+
s 可能为空,且只包含从 a-z 的小写字母。
21+
p 可能为空,且只包含从 a-z 的小写字母,以及字符 `.``*`
22+
23+
示例 1:
24+
25+
```
26+
输入:
27+
s = "aa"
28+
p = "a"
29+
输出: false
30+
解释: "a" 无法匹配 "aa" 整个字符串。
31+
```
32+
33+
示例 2:
34+
```
35+
输入:
36+
s = "aa"
37+
p = "a*"
38+
输出: true
39+
解释: `'*'` 代表可匹配零个或多个前面的元素, 即可以匹配 'a' 。因此, 重复 'a' 一次, 字符串可变为 "aa"。
40+
```
41+
42+
示例 3:
43+
```
44+
输入:
45+
s = "ab"
46+
p = ".*"
47+
输出: true
48+
解释: ".*" 表示可匹配零个或多个('*')任意字符('.')。
49+
```
50+
51+
示例 4:
52+
```
53+
输入:
54+
s = "aab"
55+
p = "c*a*b"
56+
输出: true
57+
解释: 'c' 可以不被重复, 'a' 可以被重复一次。因此可以匹配字符串 "aab"。
58+
```
59+
60+
示例 5:
61+
```
62+
输入:
63+
s = "mississippi"
64+
p = "mis*is*p*."
65+
输出: false
66+
```
67+
68+
## 思路
69+
<details>
70+
<summary>点击展开</summary>
71+
// TODO
72+
</details>
73+
74+
## 代码实现
75+
| C | C++ | Java | Objective-C | Swift | Python | JavaScript | Go | PHP |
76+
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
77+
| 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 |
78+

0 commit comments

Comments
 (0)