diff --git a/README.md b/README.md index e863a47f5..6f051c931 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,11 @@ LeetCode Problems' Solutions | # | Title | Solution | Difficulty | | :-: | - | - | :-: | +| 1411 | [Number of Ways to Paint N × 3 Grid](https://leetcode.com/problems/number-of-ways-to-paint-n-3-grid "给 N x 3 网格图涂色的方案数") | [Go](problems/number-of-ways-to-paint-n-3-grid) | Hard | +| 1410 | [HTML Entity Parser](https://leetcode.com/problems/html-entity-parser "HTML 实体解析器") | [Go](problems/html-entity-parser) | Medium | +| 1409 | [Queries on a Permutation With Key](https://leetcode.com/problems/queries-on-a-permutation-with-key "查询带键的排列") | [Go](problems/queries-on-a-permutation-with-key) | Medium | +| 1408 | [String Matching in an Array](https://leetcode.com/problems/string-matching-in-an-array "数组中的字符串匹配") | [Go](problems/string-matching-in-an-array) | Easy | +| 1407 | [Top Travellers](https://leetcode.com/problems/top-travellers) 🔒 | [MySQL](problems/top-travellers) | Easy | | 1406 | [Stone Game III](https://leetcode.com/problems/stone-game-iii "石子游戏 III") | [Go](problems/stone-game-iii) | Hard | | 1405 | [Longest Happy String](https://leetcode.com/problems/longest-happy-string "最长快乐字符串") | [Go](problems/longest-happy-string) | Medium | | 1404 | [Number of Steps to Reduce a Number in Binary Representation to One](https://leetcode.com/problems/number-of-steps-to-reduce-a-number-in-binary-representation-to-one "将二进制表示减到 1 的步骤数") | [Go](problems/number-of-steps-to-reduce-a-number-in-binary-representation-to-one) | Medium | @@ -70,7 +75,7 @@ LeetCode Problems' Solutions | 1401 | [Circle and Rectangle Overlapping](https://leetcode.com/problems/circle-and-rectangle-overlapping "圆和矩形是否有重叠") | [Go](problems/circle-and-rectangle-overlapping) | Medium | | 1400 | [Construct K Palindrome Strings](https://leetcode.com/problems/construct-k-palindrome-strings "构造 K 个回文字符串") | [Go](problems/construct-k-palindrome-strings) | Medium | | 1399 | [Count Largest Group](https://leetcode.com/problems/count-largest-group "统计最大组的数目") | [Go](problems/count-largest-group) | Easy | -| 1398 | [Customers Who Bought Products A and B but Not C](https://leetcode.com/problems/customers-who-bought-products-a-and-b-but-not-c) 🔒 | [MySQL](problems/customers-who-bought-products-a-and-b-but-not-c) | Medium | +| 1398 | [Customers Who Bought Products A and B but Not C](https://leetcode.com/problems/customers-who-bought-products-a-and-b-but-not-c "购买了产品A和产品B却没有购买产品C的顾客") 🔒 | [MySQL](problems/customers-who-bought-products-a-and-b-but-not-c) | Medium | | 1397 | [Find All Good Strings](https://leetcode.com/problems/find-all-good-strings "找到所有好字符串") | [Go](problems/find-all-good-strings) | Hard | | 1396 | [Design Underground System](https://leetcode.com/problems/design-underground-system "设计地铁系统") | [Go](problems/design-underground-system) | Medium | | 1395 | [Count Number of Teams](https://leetcode.com/problems/count-number-of-teams "统计作战单位数") | [Go](problems/count-number-of-teams) | Medium | @@ -474,7 +479,7 @@ LeetCode Problems' Solutions | 997 | [Find the Town Judge](https://leetcode.com/problems/find-the-town-judge "找到小镇的法官") | [Go](problems/find-the-town-judge) | Easy | | 996 | [Number of Squareful Arrays](https://leetcode.com/problems/number-of-squareful-arrays "正方形数组的数目") | [Go](problems/number-of-squareful-arrays) | Hard | | 995 | [Minimum Number of K Consecutive Bit Flips](https://leetcode.com/problems/minimum-number-of-k-consecutive-bit-flips "K 连续位的最小翻转次数") | [Go](problems/minimum-number-of-k-consecutive-bit-flips) | Hard | -| 994 | [Rotting Oranges](https://leetcode.com/problems/rotting-oranges "腐烂的橘子") | [Go](problems/rotting-oranges) | Easy | +| 994 | [Rotting Oranges](https://leetcode.com/problems/rotting-oranges "腐烂的橘子") | [Go](problems/rotting-oranges) | Medium | | 993 | [Cousins in Binary Tree](https://leetcode.com/problems/cousins-in-binary-tree "二叉树的堂兄弟节点") | [Go](problems/cousins-in-binary-tree) | Easy | | 992 | [Subarrays with K Different Integers](https://leetcode.com/problems/subarrays-with-k-different-integers "K 个不同整数的子数组") | [Go](problems/subarrays-with-k-different-integers) | Hard | | 991 | [Broken Calculator](https://leetcode.com/problems/broken-calculator "坏了的计算器") | [Go](problems/broken-calculator) | Medium | diff --git a/problems/best-time-to-buy-and-sell-stock-ii/README.md b/problems/best-time-to-buy-and-sell-stock-ii/README.md index 48e05d027..ab394120d 100644 --- a/problems/best-time-to-buy-and-sell-stock-ii/README.md +++ b/problems/best-time-to-buy-and-sell-stock-ii/README.md @@ -11,7 +11,7 @@ ## [122. Best Time to Buy and Sell Stock II (Easy)](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii "买卖股票的最佳时机 II") -

Say you have an array for which the ith element is the price of a given stock on day i.

+

Say you have an array prices for which the ith element is the price of a given stock on day i.

Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times).

@@ -43,6 +43,14 @@ Output: 0 Explanation: In this case, no transaction is done, i.e. max profit = 0. +

 

+

Constraints:

+ + + ### Related Topics [[Greedy](../../tag/greedy/README.md)] [[Array](../../tag/array/README.md)] diff --git a/problems/customers-who-bought-products-a-and-b-but-not-c/README.md b/problems/customers-who-bought-products-a-and-b-but-not-c/README.md index e434966cd..cf518607c 100644 --- a/problems/customers-who-bought-products-a-and-b-but-not-c/README.md +++ b/problems/customers-who-bought-products-a-and-b-but-not-c/README.md @@ -9,6 +9,6 @@                  [Next >](../count-largest-group "Count Largest Group") -## [1398. Customers Who Bought Products A and B but Not C (Medium)](https://leetcode.com/problems/customers-who-bought-products-a-and-b-but-not-c "") +## [1398. Customers Who Bought Products A and B but Not C (Medium)](https://leetcode.com/problems/customers-who-bought-products-a-and-b-but-not-c "购买了产品A和产品B却没有购买产品C的顾客") diff --git a/problems/fizz-buzz/README.md b/problems/fizz-buzz/README.md index cae237242..89105359b 100644 --- a/problems/fizz-buzz/README.md +++ b/problems/fizz-buzz/README.md @@ -39,3 +39,6 @@ Return: ]

+ +### Similar Questions + 1. [Fizz Buzz Multithreaded](../fizz-buzz-multithreaded) (Medium) diff --git a/problems/happy-number/README.md b/problems/happy-number/README.md index b1cf88483..5c6fe7fc3 100644 --- a/problems/happy-number/README.md +++ b/problems/happy-number/README.md @@ -11,9 +11,11 @@ ## [202. Happy Number (Easy)](https://leetcode.com/problems/happy-number "快乐数") -

Write an algorithm to determine if a number is "happy".

+

Write an algorithm to determine if a number n is "happy".

-

A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers.

+

A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers.

+ +

Return True if n is a happy number, and False if not.

Example: 

diff --git a/problems/html-entity-parser/README.md b/problems/html-entity-parser/README.md new file mode 100644 index 000000000..580a68168 --- /dev/null +++ b/problems/html-entity-parser/README.md @@ -0,0 +1,89 @@ + + + + + + + +[< Previous](../queries-on-a-permutation-with-key "Queries on a Permutation With Key") +                 +[Next >](../number-of-ways-to-paint-n-3-grid "Number of Ways to Paint N × 3 Grid") + +## [1410. HTML Entity Parser (Medium)](https://leetcode.com/problems/html-entity-parser "HTML 实体解析器") + +

HTML entity parser is the parser that takes HTML code as input and replace all the entities of the special characters by the characters itself.

+ +

The special characters and their entities for HTML are:

+ + + +

Given the input text string to the HTML parser, you have to implement the entity parser.

+ +

Return the text after replacing the entities by the special characters.

+ +

 

+

Example 1:

+ +
+Input: text = "&amp; is an HTML entity but &ambassador; is not."
+Output: "& is an HTML entity but &ambassador; is not."
+Explanation: The parser will replace the &amp; entity by &
+
+ +

Example 2:

+ +
+Input: text = "and I quote: &quot;...&quot;"
+Output: "and I quote: \"...\""
+
+ +

Example 3:

+ +
+Input: text = "Stay home! Practice on Leetcode :)"
+Output: "Stay home! Practice on Leetcode :)"
+
+ +

Example 4:

+ +
+Input: text = "x &gt; y &amp;&amp; x &lt; y is always false"
+Output: "x > y && x < y is always false"
+
+ +

Example 5:

+ +
+Input: text = "leetcode.com&frasl;problemset&frasl;all"
+Output: "leetcode.com/problemset/all"
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Stack](../../tag/stack/README.md)] + [[String](../../tag/string/README.md)] + +### Hints +
+Hint 1 +Search the string for all the occurrences of the character '&'. +
+ +
+Hint 2 +For every '&' check if it matches an HTML entity by checking the ';' character and if entity found replace it in the answer. +
diff --git a/problems/last-stone-weight/README.md b/problems/last-stone-weight/README.md index b45df5262..06263254a 100644 --- a/problems/last-stone-weight/README.md +++ b/problems/last-stone-weight/README.md @@ -11,9 +11,9 @@ ## [1046. Last Stone Weight (Easy)](https://leetcode.com/problems/last-stone-weight "最后一块石头的重量") -

We have a collection of rocks, each rock has a positive integer weight.

+

We have a collection of stones, each stone has a positive integer weight.

-

Each turn, we choose the two heaviest rocks and smash them together.  Suppose the stones have weights x and y with x <= y.  The result of this smash is:

+

Each turn, we choose the two heaviest stones and smash them together.  Suppose the stones have weights x and y with x <= y.  The result of this smash is: