Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add: README
  • Loading branch information
openset committed Feb 11, 2019
commit 487e184522985c02e06b935ed2ee8740ab8be1be
22 changes: 21 additions & 1 deletion problems/employee-free-time/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
## 759. Employee Free Time
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
<!--+----------------------------------------------------------------------+-->
<!--|@author Openset <openset.wang@gmail.com> |-->
<!--|@link https://github.com/openset |-->
<!--|@home https://github.com/openset/leetcode |-->
<!--+----------------------------------------------------------------------+-->

## 759. Employee Free Time (Hard)



### Related Topics
[[Heap](https://github.com/openset/leetcode/tree/master/tag/heap/README.md)]
[[Greedy](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)]

### Similar Questions
1. [Merge Intervals](https://github.com/openset/leetcode/tree/master/problems/merge-intervals) (Medium)

### Hints
1. Take all the intervals and do an "events" (or "line sweep") approach - an event of (x, OPEN) increases the number of active intervals, while (x, CLOSE) decreases it.

Processing in sorted order from left to right, if the number of active intervals is zero, then you crossed a region of common free time.
19 changes: 18 additions & 1 deletion problems/encode-and-decode-strings/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
## 271. Encode and Decode Strings
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
<!--+----------------------------------------------------------------------+-->
<!--|@author Openset <openset.wang@gmail.com> |-->
<!--|@link https://github.com/openset |-->
<!--|@home https://github.com/openset/leetcode |-->
<!--+----------------------------------------------------------------------+-->

## 271. Encode and Decode Strings (Medium)



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

### Similar Questions
1. [Count and Say](https://github.com/openset/leetcode/tree/master/problems/count-and-say) (Easy)
1. [Serialize and Deserialize Binary Tree](https://github.com/openset/leetcode/tree/master/problems/serialize-and-deserialize-binary-tree) (Hard)
1. [String Compression](https://github.com/openset/leetcode/tree/master/problems/string-compression) (Easy)
1. [Count Binary Substrings](https://github.com/openset/leetcode/tree/master/problems/count-binary-substrings) (Easy)
16 changes: 15 additions & 1 deletion problems/encode-n-ary-tree-to-binary-tree/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
## 431. Encode N-ary Tree to Binary Tree
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
<!--+----------------------------------------------------------------------+-->
<!--|@author Openset <openset.wang@gmail.com> |-->
<!--|@link https://github.com/openset |-->
<!--|@home https://github.com/openset/leetcode |-->
<!--+----------------------------------------------------------------------+-->

## 431. Encode N-ary Tree to Binary Tree (Hard)



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

### Similar Questions
1. [Serialize and Deserialize N-ary Tree](https://github.com/openset/leetcode/tree/master/problems/serialize-and-deserialize-n-ary-tree) (Hard)
17 changes: 16 additions & 1 deletion problems/encode-string-with-shortest-length/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
## 471. Encode String with Shortest Length
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
<!--+----------------------------------------------------------------------+-->
<!--|@author Openset <openset.wang@gmail.com> |-->
<!--|@link https://github.com/openset |-->
<!--|@home https://github.com/openset/leetcode |-->
<!--+----------------------------------------------------------------------+-->

## 471. Encode String with Shortest Length (Hard)



### Related Topics
[[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)]

### Similar Questions
1. [Decode String](https://github.com/openset/leetcode/tree/master/problems/decode-string) (Medium)
1. [Number of Atoms](https://github.com/openset/leetcode/tree/master/problems/number-of-atoms) (Hard)
16 changes: 15 additions & 1 deletion problems/factor-combinations/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
## 254. Factor Combinations
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
<!--+----------------------------------------------------------------------+-->
<!--|@author Openset <openset.wang@gmail.com> |-->
<!--|@link https://github.com/openset |-->
<!--|@home https://github.com/openset/leetcode |-->
<!--+----------------------------------------------------------------------+-->

## 254. Factor Combinations (Medium)



### Related Topics
[[Backtracking](https://github.com/openset/leetcode/tree/master/tag/backtracking/README.md)]

### Similar Questions
1. [Combination Sum](https://github.com/openset/leetcode/tree/master/problems/combination-sum) (Medium)
16 changes: 15 additions & 1 deletion problems/find-anagram-mappings/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
## 760. Find Anagram Mappings
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
<!--+----------------------------------------------------------------------+-->
<!--|@author Openset <openset.wang@gmail.com> |-->
<!--|@link https://github.com/openset |-->
<!--|@home https://github.com/openset/leetcode |-->
<!--+----------------------------------------------------------------------+-->

## 760. Find Anagram Mappings (Easy)



### Related Topics
[[Hash Table](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)]

### Hints
1. Create a hashmap so that D[x] = i whenever B[i] = x. Then, the answer is [D[x] for x in A].
14 changes: 13 additions & 1 deletion problems/find-leaves-of-binary-tree/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
## 366. Find Leaves of Binary Tree
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
<!--+----------------------------------------------------------------------+-->
<!--|@author Openset <openset.wang@gmail.com> |-->
<!--|@link https://github.com/openset |-->
<!--|@home https://github.com/openset/leetcode |-->
<!--+----------------------------------------------------------------------+-->

## 366. Find Leaves of Binary Tree (Medium)



### Related Topics
[[Tree](https://github.com/openset/leetcode/tree/master/tag/tree/README.md)]
[[Depth-first Search](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)]
13 changes: 12 additions & 1 deletion problems/find-median-given-frequency-of-numbers/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
## 571. Find Median Given Frequency of Numbers
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
<!--+----------------------------------------------------------------------+-->
<!--|@author Openset <openset.wang@gmail.com> |-->
<!--|@link https://github.com/openset |-->
<!--|@home https://github.com/openset/leetcode |-->
<!--+----------------------------------------------------------------------+-->

## 571. Find Median Given Frequency of Numbers (Hard)



### Similar Questions
1. [Median Employee Salary](https://github.com/openset/leetcode/tree/master/problems/median-employee-salary) (Hard)
13 changes: 12 additions & 1 deletion problems/find-the-celebrity/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
## 277. Find the Celebrity
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
<!--+----------------------------------------------------------------------+-->
<!--|@author Openset <openset.wang@gmail.com> |-->
<!--|@link https://github.com/openset |-->
<!--|@home https://github.com/openset/leetcode |-->
<!--+----------------------------------------------------------------------+-->

## 277. Find the Celebrity (Medium)



### Related Topics
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
56 changes: 55 additions & 1 deletion problems/output-contest-matches/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,56 @@
## 544. Output Contest Matches
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
<!--+----------------------------------------------------------------------+-->
<!--|@author Openset <openset.wang@gmail.com> |-->
<!--|@link https://github.com/openset |-->
<!--|@home https://github.com/openset/leetcode |-->
<!--+----------------------------------------------------------------------+-->

## 544. Output Contest Matches (Medium)

<p>
During the NBA playoffs, we always arrange the rather strong team to play with the rather weak team, like make the rank 1 team play with the rank n<sub>th</sub> team, which is a good strategy to make the contest more interesting. Now, you're given <b>n</b> teams, you need to output their <b>final</b> contest matches in the form of a string.
</p>

<p>The <b>n</b> teams are given in the form of positive integers from 1 to n, which represents their initial rank. (Rank 1 is the strongest team and Rank n is the weakest team.) We'll use parentheses('(', ')') and commas(',') to represent the contest team pairing - parentheses('(' , ')') for pairing and commas(',') for partition. During the pairing process in each round, you always need to follow the strategy of making the rather strong one pair with the rather weak one.</p>

<p><b>Example 1:</b><br />
<pre><b>Input:</b> 2
<b>Output:</b> (1,2)
<b>Explanation:</b>
Initially, we have the team 1 and the team 2, placed like: 1,2.
Then we pair the team (1,2) together with '(', ')' and ',', which is the final answer.
</pre>
</p>

<p><b>Example 2:</b><br />
<pre><b>Input:</b> 4
<b>Output:</b> ((1,4),(2,3))
<b>Explanation:</b>
In the first round, we pair the team 1 and 4, the team 2 and 3 together, as we need to make the strong team and weak team together.
And we got (1,4),(2,3).
In the second round, the winners of (1,4) and (2,3) need to play again to generate the final winner, so you need to add the paratheses outside them.
And we got the final answer ((1,4),(2,3)).
</pre>
</p>

<p><b>Example 3:</b><br />
<pre><b>Input:</b> 8
<b>Output:</b> (((1,8),(4,5)),((2,7),(3,6)))
<b>Explanation:</b>
First round: (1,8),(2,7),(3,6),(4,5)
Second round: ((1,8),(4,5)),((2,7),(3,6))
Third round: (((1,8),(4,5)),((2,7),(3,6)))
Since the third round will generate the final winner, you need to output the answer (((1,8),(4,5)),((2,7),(3,6))).
</pre>
</p>

<p><b>Note:</b><br>
<ol>
<li>The <b>n</b> is in range [2, 2<sup>12</sup>].</li>
<li>We ensure that the input <b>n</b> can be converted into the form 2<sup>k</sup>, where k is a positive integer.</li>
</ol>
</p>

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