diff --git a/README.md b/README.md index 438dbe736..06535fd8f 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,10 @@ LeetCode Problems' Solutions | # | Title | Solution | Difficulty | | :-: | - | - | :-: | +| 1111 | [Maximum Nesting Depth of Two Valid Parentheses Strings](https://leetcode.com/problems/maximum-nesting-depth-of-two-valid-parentheses-strings "有效括号的嵌套深度") | [Go](https://github.com/openset/leetcode/tree/master/problems/maximum-nesting-depth-of-two-valid-parentheses-strings) | Medium | +| 1110 | [Delete Nodes And Return Forest](https://leetcode.com/problems/delete-nodes-and-return-forest "删点成林") | [Go](https://github.com/openset/leetcode/tree/master/problems/delete-nodes-and-return-forest) | Medium | +| 1109 | [Corporate Flight Bookings](https://leetcode.com/problems/corporate-flight-bookings "航班预订统计") | [Go](https://github.com/openset/leetcode/tree/master/problems/corporate-flight-bookings) | Medium | +| 1108 | [Defanging an IP Address](https://leetcode.com/problems/defanging-an-ip-address "IP 地址无效化") | [Go](https://github.com/openset/leetcode/tree/master/problems/defanging-an-ip-address) | Easy | | 1107 | [New Users Daily Count](https://leetcode.com/problems/new-users-daily-count) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/new-users-daily-count) | Medium | | 1106 | [Parsing A Boolean Expression](https://leetcode.com/problems/parsing-a-boolean-expression "解析布尔表达式") | [Go](https://github.com/openset/leetcode/tree/master/problems/parsing-a-boolean-expression) | Hard | | 1105 | [Filling Bookcase Shelves](https://leetcode.com/problems/filling-bookcase-shelves "填充书架") | [Go](https://github.com/openset/leetcode/tree/master/problems/filling-bookcase-shelves) | Medium | diff --git a/problems/corporate-flight-bookings/README.md b/problems/corporate-flight-bookings/README.md new file mode 100644 index 000000000..a5e1b3f66 --- /dev/null +++ b/problems/corporate-flight-bookings/README.md @@ -0,0 +1,35 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/defanging-an-ip-address "Defanging an IP Address") +                 +[Next >](https://github.com/openset/leetcode/tree/master/problems/delete-nodes-and-return-forest "Delete Nodes And Return Forest") + +## 1109. Corporate Flight Bookings (Medium) + +

There are n flights, and they are labeled from 1 to n.

+ +

We have a list of flight bookings.  The i-th booking bookings[i] = [i, j, k] means that we booked k seats from flights labeled i to j inclusive.

+ +

Return an array answer of length n, representing the number of seats booked on each flight in order of their label.

+ +

 

+

Example 1:

+ +
+Input: bookings = [[1,2,10],[2,3,20],[2,5,25]], n = 5
+Output: [10,55,45,25,25]
+
+ +

 

+

Constraints:

+ + diff --git a/problems/defanging-an-ip-address/README.md b/problems/defanging-an-ip-address/README.md new file mode 100644 index 000000000..e3b427160 --- /dev/null +++ b/problems/defanging-an-ip-address/README.md @@ -0,0 +1,31 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/new-users-daily-count "New Users Daily Count") +                 +[Next >](https://github.com/openset/leetcode/tree/master/problems/corporate-flight-bookings "Corporate Flight Bookings") + +## 1108. Defanging an IP Address (Easy) + +

Given a valid (IPv4) IP address, return a defanged version of that IP address.

+ +

A defanged IP address replaces every period "." with "[.]".

+ +

 

+

Example 1:

+
Input: address = "1.1.1.1"
+Output: "1[.]1[.]1[.]1"
+

Example 2:

+
Input: address = "255.100.50.0"
+Output: "255[.]100[.]50[.]0"
+
+

 

+

Constraints:

+ + diff --git a/problems/delete-nodes-and-return-forest/README.md b/problems/delete-nodes-and-return-forest/README.md new file mode 100644 index 000000000..1fce5e7b0 --- /dev/null +++ b/problems/delete-nodes-and-return-forest/README.md @@ -0,0 +1,38 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/corporate-flight-bookings "Corporate Flight Bookings") +                 +[Next >](https://github.com/openset/leetcode/tree/master/problems/maximum-nesting-depth-of-two-valid-parentheses-strings "Maximum Nesting Depth of Two Valid Parentheses Strings") + +## 1110. Delete Nodes And Return Forest (Medium) + +

Given the root of a binary tree, each node in the tree has a distinct value.

+ +

After deleting all nodes with a value in to_delete, we are left with a forest (a disjoint union of trees).

+ +

Return the roots of the trees in the remaining forest.  You may return the result in any order.

+ +

 

+

Example 1:

+ +

+ +
+Input: root = [1,2,3,4,5,6,7], to_delete = [3,5]
+Output: [[1,2,null,4],[6],[7]]
+
+ +

 

+

Constraints:

+ + diff --git a/problems/maximum-nesting-depth-of-two-valid-parentheses-strings/README.md b/problems/maximum-nesting-depth-of-two-valid-parentheses-strings/README.md new file mode 100644 index 000000000..982a6e671 --- /dev/null +++ b/problems/maximum-nesting-depth-of-two-valid-parentheses-strings/README.md @@ -0,0 +1,60 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/delete-nodes-and-return-forest "Delete Nodes And Return Forest") +                 +Next > + +## 1111. Maximum Nesting Depth of Two Valid Parentheses Strings (Hard) + +

A string is a valid parentheses string (denoted VPS) if and only if it consists of "(" and ")" characters only, and:

+ + + +

We can similarly define the nesting depth depth(S) of any VPS S as follows:

+ + + +

For example,  """()()", and "()(()())" are VPS's (with nesting depths 0, 1, and 2), and ")(" and "(()" are not VPS's.

+ +

 

+ +

Given a VPS seq, split it into two disjoint subsequences A and B, such that A and B are VPS's (and A.length + B.length = seq.length).

+ +

Now choose any such A and B such that max(depth(A), depth(B)) is the minimum possible value.

+ +

Return an answer array (of length seq.length) that encodes such a choice of A and Banswer[i] = 0 if seq[i] is part of A, else answer[i] = 1.  Note that even though multiple answers may exist, you may return any of them.

+ +

 

+

Example 1:

+ +
+Input: seq = "(()())"
+Output: [0,1,1,1,1,0]
+
+ +

Example 2:

+ +
+Input: seq = "()(())()"
+Output: [0,0,0,1,1,0,1,1]
+
+ +

 

+

Constraints:

+ + diff --git a/problems/new-users-daily-count/README.md b/problems/new-users-daily-count/README.md index 5a74fd74f..d9e9a3ad1 100644 --- a/problems/new-users-daily-count/README.md +++ b/problems/new-users-daily-count/README.md @@ -7,7 +7,7 @@ [< Previous](https://github.com/openset/leetcode/tree/master/problems/parsing-a-boolean-expression "Parsing A Boolean Expression")                  -Next > +[Next >](https://github.com/openset/leetcode/tree/master/problems/defanging-an-ip-address "Defanging an IP Address") ## 1107. New Users Daily Count (Medium)