From 42a34e7af6d06628e1ab8b4e3b2a82041aad063f Mon Sep 17 00:00:00 2001 From: openset Date: Thu, 14 Nov 2019 20:19:27 +0800 Subject: [PATCH] Update: chan --- internal/description/description.go | 5 ++- .../README.md | 2 +- .../verifying-an-alien-dictionary/README.md | 35 +++++++------------ 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/internal/description/description.go b/internal/description/description.go index 97aa7d045..01f445d07 100644 --- a/internal/description/description.go +++ b/internal/description/description.go @@ -23,9 +23,8 @@ func runDescription(cmd *base.Command, args []string) { return } var wg sync.WaitGroup - limit := 1 << 7 - jobs := make(chan leetcode.StatStatusPairsType, limit) - for i := 0; i < limit; i++ { + jobs := make(chan leetcode.StatStatusPairsType) + for i := 0; i < 1<<7; i++ { go worker(jobs, &wg) } problems := leetcode.ProblemsAll() diff --git a/problems/closest-binary-search-tree-value/README.md b/problems/closest-binary-search-tree-value/README.md index 1a22d9301..8a56c2db9 100644 --- a/problems/closest-binary-search-tree-value/README.md +++ b/problems/closest-binary-search-tree-value/README.md @@ -14,8 +14,8 @@ ### Related Topics - [[Binary Search](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] [[Tree](https://github.com/openset/leetcode/tree/master/tag/tree/README.md)] + [[Binary Search](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] ### Similar Questions 1. [Count Complete Tree Nodes](https://github.com/openset/leetcode/tree/master/problems/count-complete-tree-nodes) (Medium) diff --git a/problems/verifying-an-alien-dictionary/README.md b/problems/verifying-an-alien-dictionary/README.md index 93b5e83f9..235591033 100644 --- a/problems/verifying-an-alien-dictionary/README.md +++ b/problems/verifying-an-alien-dictionary/README.md @@ -14,49 +14,40 @@

In an alien language, surprisingly they also use english lowercase letters, but possibly in a different order. The order of the alphabet is some permutation of lowercase letters.

Given a sequence of words written in the alien language, and the order of the alphabet, return true if and only if the given words are sorted lexicographicaly in this alien language.

-

 

- -

Example 1:

-Input: words = ["hello","leetcode"], order = "hlabcdefgijkmnopqrstuvwxyz"
-Output: true
-Explanation: As 'h' comes before 'l' in this language, then the sequence is sorted.
+Input: words = ["hello","leetcode"], order = "hlabcdefgijkmnopqrstuvwxyz"
+Output: true
+Explanation: As 'h' comes before 'l' in this language, then the sequence is sorted.
 
-

Example 2:

-Input: words = ["word","world","row"], order = "worldabcefghijkmnpqstuvxyz"
-Output: false
-Explanation: As 'd' comes after 'l' in this language, then words[0] > words[1], hence the sequence is unsorted.
+Input: words = ["word","world","row"], order = "worldabcefghijkmnpqstuvxyz"
+Output: false
+Explanation: As 'd' comes after 'l' in this language, then words[0] > words[1], hence the sequence is unsorted.
 
-

Example 3:

-Input: words = ["apple","app"], order = "abcdefghijklmnopqrstuvwxyz"
-Output: false
-Explanation: The first three characters "app" match, and the second string is shorter (in size.) According to lexicographical rules "apple" > "app", because 'l' > '∅', where '∅' is defined as the blank character which is less than any other character (More info).
+Input: words = ["apple","app"], order = "abcdefghijklmnopqrstuvwxyz"
+Output: false
+Explanation: The first three characters "app" match, and the second string is shorter (in size.) According to lexicographical rules "apple" > "app", because 'l' > '∅', where '∅' is defined as the blank character which is less than any other character (More info).
 

 

+

Constraints:

-

Note:

- -
    +
    • 1 <= words.length <= 100
    • 1 <= words[i].length <= 20
    • order.length == 26
    • -
    • All characters in words[i] and order are english lowercase letters.
    • -
-
-
-
+
  • All characters in words[i] and order are English lowercase letters.
  • + ### Related Topics [[Hash Table](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)]