Skip to content

Commit 9ad583d

Browse files
author
Shuo
authored
Merge pull request #602 from openset/develop
Update: description
2 parents ada1c54 + 2fd3e85 commit 9ad583d

File tree

9 files changed

+50
-8
lines changed

9 files changed

+50
-8
lines changed

problems/binary-tree-inorder-traversal/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
<p><strong>Follow up:</strong> Recursive solution is trivial, could you do it iteratively?</p>
2929

3030
### Related Topics
31-
[[Hash Table](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)]
3231
[[Stack](https://github.com/openset/leetcode/tree/master/tag/stack/README.md)]
3332
[[Tree](https://github.com/openset/leetcode/tree/master/tag/tree/README.md)]
33+
[[Hash Table](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)]
3434

3535
### Similar Questions
3636
1. [Validate Binary Search Tree](https://github.com/openset/leetcode/tree/master/problems/validate-binary-search-tree) (Medium)

problems/construct-binary-tree-from-inorder-and-postorder-traversal/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ postorder = [9,15,7,20,3]</pre>
3333
</pre>
3434

3535
### Related Topics
36-
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
3736
[[Tree](https://github.com/openset/leetcode/tree/master/tag/tree/README.md)]
3837
[[Depth-first Search](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)]
38+
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
3939

4040
### Similar Questions
4141
1. [Construct Binary Tree from Preorder and Inorder Traversal](https://github.com/openset/leetcode/tree/master/problems/construct-binary-tree-from-preorder-and-inorder-traversal) (Medium)

problems/construct-binary-tree-from-preorder-and-inorder-traversal/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ inorder = [9,3,15,20,7]</pre>
3232
15 7</pre>
3333

3434
### Related Topics
35-
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
3635
[[Tree](https://github.com/openset/leetcode/tree/master/tag/tree/README.md)]
3736
[[Depth-first Search](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)]
37+
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
3838

3939
### Similar Questions
4040
1. [Construct Binary Tree from Inorder and Postorder Traversal](https://github.com/openset/leetcode/tree/master/problems/construct-binary-tree-from-inorder-and-postorder-traversal) (Medium)

problems/encode-and-decode-strings/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,49 @@
1111

1212
## 271. Encode and Decode Strings (Medium)
1313

14+
<p>Design an algorithm to encode <b>a list of strings</b> to <b>a string</b>. The encoded string is then sent over the network and is decoded back to the original list of strings.</p>
1415

16+
<p>Machine 1 (sender) has the function:</p>
17+
18+
<pre>
19+
string encode(vector&lt;string&gt; strs) {
20+
// ... your code
21+
return encoded_string;
22+
}</pre>
23+
Machine 2 (receiver) has the function:
24+
25+
<pre>
26+
vector&lt;string&gt; decode(string s) {
27+
//... your code
28+
return strs;
29+
}
30+
</pre>
31+
32+
<p>So Machine 1 does:</p>
33+
34+
<pre>
35+
string encoded_string = encode(strs);
36+
</pre>
37+
38+
<p>and Machine 2 does:</p>
39+
40+
<pre>
41+
vector&lt;string&gt; strs2 = decode(encoded_string);
42+
</pre>
43+
44+
<p><code>strs2</code> in Machine 2 should be the same as <code>strs</code> in Machine 1.</p>
45+
46+
<p>Implement the <code>encode</code> and <code>decode</code> methods.</p>
47+
48+
<p>&nbsp;</p>
49+
50+
<p><b>Note:</b></p>
51+
52+
<ul>
53+
<li>The string may contain any possible characters out of 256 valid ascii characters. Your algorithm should be generalized enough to work on any possible characters.</li>
54+
<li>Do not use class member/global/static variables to store states. Your encode and decode algorithms should be stateless.</li>
55+
<li>Do not rely on any library method such as <code>eval</code> or serialize methods. You should implement your own encode/decode algorithm.</li>
56+
</ul>
1557

1658
### Related Topics
1759
[[String](https://github.com/openset/leetcode/tree/master/tag/string/README.md)]

problems/largest-rectangle-in-histogram/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
</pre>
3434

3535
### Related Topics
36-
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
3736
[[Stack](https://github.com/openset/leetcode/tree/master/tag/stack/README.md)]
37+
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
3838

3939
### Similar Questions
4040
1. [Maximal Rectangle](https://github.com/openset/leetcode/tree/master/problems/maximal-rectangle) (Hard)

problems/maximal-rectangle/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
</pre>
2828

2929
### Related Topics
30+
[[Stack](https://github.com/openset/leetcode/tree/master/tag/stack/README.md)]
3031
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
3132
[[Hash Table](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)]
3233
[[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)]
33-
[[Stack](https://github.com/openset/leetcode/tree/master/tag/stack/README.md)]
3434

3535
### Similar Questions
3636
1. [Largest Rectangle in Histogram](https://github.com/openset/leetcode/tree/master/problems/largest-rectangle-in-histogram) (Hard)

problems/subsets/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
]</pre>
3333

3434
### Related Topics
35+
[[Bit Manipulation](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md)]
3536
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
3637
[[Backtracking](https://github.com/openset/leetcode/tree/master/tag/backtracking/README.md)]
37-
[[Bit Manipulation](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md)]
3838

3939
### Similar Questions
4040
1. [Subsets II](https://github.com/openset/leetcode/tree/master/problems/subsets-ii) (Medium)

problems/unique-binary-search-trees-ii/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ The above output corresponds to the 5 unique BST&#39;s shown below:
3636
</pre>
3737

3838
### Related Topics
39-
[[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)]
4039
[[Tree](https://github.com/openset/leetcode/tree/master/tag/tree/README.md)]
40+
[[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)]
4141

4242
### Similar Questions
4343
1. [Unique Binary Search Trees](https://github.com/openset/leetcode/tree/master/problems/unique-binary-search-trees) (Medium)

problems/unique-binary-search-trees/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
</pre>
3030

3131
### Related Topics
32-
[[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)]
3332
[[Tree](https://github.com/openset/leetcode/tree/master/tag/tree/README.md)]
33+
[[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)]
3434

3535
### Similar Questions
3636
1. [Unique Binary Search Trees II](https://github.com/openset/leetcode/tree/master/problems/unique-binary-search-trees-ii) (Medium)

0 commit comments

Comments
 (0)