Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitde54b60

Browse files
committed
added empty solution files to all problems
1 parent6c8f317 commitde54b60

File tree

162 files changed

+6282
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+6282
-9
lines changed

‎10-Regular-Expression-Matching.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
##Regular Expression Matching
2+
Source:https://oj.leetcode.com/problems/regular-expression-matching
3+
###Description
4+
5+
6+
Implement regular expression matching with support for
7+
'.'
8+
and
9+
'*'
10+
.
11+
12+
13+
14+
15+
'.' Matches any single character.
16+
'*' Matches zero or more of the preceding element.
17+
18+
The matching should cover the
19+
entire
20+
input string (not partial).
21+
22+
The function prototype should be:
23+
bool isMatch(const char*s, const char*p)
24+
25+
Some examples:
26+
isMatch("aa","a") → false
27+
isMatch("aa","aa") → true
28+
isMatch("aaa","aa") → false
29+
isMatch("aa", "a*") → true
30+
isMatch("aa", ".*") → true
31+
isMatch("ab", ".*") → true
32+
isMatch("aab", "c*a*b") → true
33+
###Tags
34+
Dynamic Programming, Backtracking, String
35+
###Solutions

‎100-Same-Tree.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
##Same Tree
2+
Source:https://oj.leetcode.com/problems/same-tree
3+
###Description
4+
5+
6+
7+
Given two binary trees, write a function to check if they are equal or not.
8+
9+
10+
11+
12+
Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
13+
###Tags
14+
Tree, Depth-first Search
15+
###Solutions

‎101-Symmetric-Tree.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
##Symmetric Tree
2+
Source:https://oj.leetcode.com/problems/symmetric-tree
3+
###Description
4+
5+
6+
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
7+
8+
9+
10+
11+
For example, this binary tree is symmetric:
12+
13+
14+
1
15+
/\
16+
2 2
17+
/ \ /\
18+
3 4 4 3
19+
20+
21+
22+
23+
24+
But the following is not:
25+
26+
27+
28+
1
29+
/\
30+
2 2
31+
\\
32+
3 3
33+
34+
35+
36+
37+
38+
39+
40+
Note:
41+
42+
Bonus points if you could solve it both recursively and iteratively.
43+
44+
45+
46+
47+
confused what
48+
"{1,#,2,3}"
49+
means?
50+
>read more on how binary tree is serialized on OJ.
51+
52+
53+
54+
OJ's Binary Tree Serialization:
55+
56+
57+
58+
The serialization of a binary tree follows a level order traversal, where '#' signifies a path terminator where no node exists below.
59+
60+
61+
62+
63+
Here's an example:
64+
65+
66+
67+
1
68+
/\
69+
2 3
70+
/
71+
4
72+
\
73+
5
74+
75+
76+
The above binary tree is serialized as
77+
"{1,2,3,#,#,4,#,#,5}"
78+
.
79+
###Tags
80+
Tree, Depth-first Search
81+
###Solutions
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
##Binary Tree Level Order Traversal
2+
Source:https://oj.leetcode.com/problems/binary-tree-level-order-traversal
3+
###Description
4+
5+
6+
Given a binary tree, return the
7+
level order
8+
traversal of its nodes' values. (ie, from left to right, level by level).
9+
10+
11+
12+
13+
For example:
14+
15+
Given binary tree
16+
{3,9,20,#,#,15,7}
17+
,
18+
19+
20+
21+
3
22+
/\
23+
9 20
24+
/\
25+
15 7
26+
27+
28+
29+
30+
31+
return its level order traversal as:
32+
33+
34+
35+
[
36+
[3],
37+
[9,20],
38+
[15,7]
39+
]
40+
41+
42+
43+
44+
45+
confused what
46+
"{1,#,2,3}"
47+
means?
48+
>read more on how binary tree is serialized on OJ.
49+
50+
51+
52+
OJ's Binary Tree Serialization:
53+
54+
55+
56+
The serialization of a binary tree follows a level order traversal, where '#' signifies a path terminator where no node exists below.
57+
58+
59+
60+
61+
Here's an example:
62+
63+
64+
65+
1
66+
/\
67+
2 3
68+
/
69+
4
70+
\
71+
5
72+
73+
74+
The above binary tree is serialized as
75+
"{1,2,3,#,#,4,#,#,5}"
76+
.
77+
###Tags
78+
Tree, Breadth-first Search
79+
###Solutions
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
##Binary Tree Zigzag Level Order Traversal
2+
Source:https://oj.leetcode.com/problems/binary-tree-zigzag-level-order-traversal
3+
###Description
4+
5+
6+
Given a binary tree, return the
7+
zigzag level order
8+
traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
9+
10+
11+
12+
13+
For example:
14+
15+
Given binary tree
16+
{3,9,20,#,#,15,7}
17+
,
18+
19+
20+
21+
3
22+
/\
23+
9 20
24+
/\
25+
15 7
26+
27+
28+
29+
30+
31+
return its zigzag level order traversal as:
32+
33+
34+
35+
[
36+
[3],
37+
[20,9],
38+
[15,7]
39+
]
40+
41+
42+
43+
44+
45+
confused what
46+
"{1,#,2,3}"
47+
means?
48+
>read more on how binary tree is serialized on OJ.
49+
50+
51+
52+
OJ's Binary Tree Serialization:
53+
54+
55+
56+
The serialization of a binary tree follows a level order traversal, where '#' signifies a path terminator where no node exists below.
57+
58+
59+
60+
61+
Here's an example:
62+
63+
64+
65+
1
66+
/\
67+
2 3
68+
/
69+
4
70+
\
71+
5
72+
73+
74+
The above binary tree is serialized as
75+
"{1,2,3,#,#,4,#,#,5}"
76+
.
77+
###Tags
78+
Tree, Breadth-first Search, Stack
79+
###Solutions

‎104-Maximum-Depth-of-Binary-Tree.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
##Maximum Depth of Binary Tree
2+
Source:https://oj.leetcode.com/problems/maximum-depth-of-binary-tree
3+
###Description
4+
5+
6+
Given a binary tree, find its maximum depth.
7+
8+
9+
10+
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
11+
###Tags
12+
Tree, Depth-first Search
13+
###Solutions
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
##Construct Binary Tree from Preorder and Inorder Traversal
2+
Source:https://oj.leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal
3+
###Description
4+
5+
6+
Given preorder and inorder traversal of a tree, construct the binary tree.
7+
8+
9+
10+
Note:
11+
12+
You may assume that duplicates do not exist in the tree.
13+
###Tags
14+
Tree, Array, Depth-first Search
15+
###Solutions
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
##Construct Binary Tree from Inorder and Postorder Traversal
2+
Source:https://oj.leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal
3+
###Description
4+
5+
6+
Given inorder and postorder traversal of a tree, construct the binary tree.
7+
8+
9+
10+
Note:
11+
12+
You may assume that duplicates do not exist in the tree.
13+
###Tags
14+
Tree, Array, Depth-first Search
15+
###Solutions

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp