Skip to content

Commit 7af862d

Browse files
author
Shuo
committed
A: new
1 parent 487b0d5 commit 7af862d

File tree

26 files changed

+700
-20
lines changed

26 files changed

+700
-20
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,20 @@ LeetCode Problems' Solutions
6262

6363
| # | Title | Solution | Difficulty |
6464
| :-: | - | - | :-: |
65+
| <span id="1406">1406</span> | [Stone Game III](https://leetcode.com/problems/stone-game-iii "石子游戏 III") | [Go](problems/stone-game-iii) | Hard |
66+
| <span id="1405">1405</span> | [Longest Happy String](https://leetcode.com/problems/longest-happy-string "最长快乐字符串") | [Go](problems/longest-happy-string) | Medium |
67+
| <span id="1404">1404</span> | [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 |
68+
| <span id="1403">1403</span> | [Minimum Subsequence in Non-Increasing Order](https://leetcode.com/problems/minimum-subsequence-in-non-increasing-order "非递增顺序的最小子序列") | [Go](problems/minimum-subsequence-in-non-increasing-order) | Easy |
69+
| <span id="1402">1402</span> | [Reducing Dishes](https://leetcode.com/problems/reducing-dishes "做菜顺序") | [Go](problems/reducing-dishes) | Hard |
70+
| <span id="1401">1401</span> | [Circle and Rectangle Overlapping](https://leetcode.com/problems/circle-and-rectangle-overlapping "圆和矩形是否有重叠") | [Go](problems/circle-and-rectangle-overlapping) | Medium |
71+
| <span id="1400">1400</span> | [Construct K Palindrome Strings](https://leetcode.com/problems/construct-k-palindrome-strings "构造 K 个回文字符串") | [Go](problems/construct-k-palindrome-strings) | Medium |
72+
| <span id="1399">1399</span> | [Count Largest Group](https://leetcode.com/problems/count-largest-group "统计最大组的数目") | [Go](problems/count-largest-group) | Easy |
73+
| <span id="1398">1398</span> | [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 |
6574
| <span id="1397">1397</span> | [Find All Good Strings](https://leetcode.com/problems/find-all-good-strings "找到所有好字符串") | [Go](problems/find-all-good-strings) | Hard |
6675
| <span id="1396">1396</span> | [Design Underground System](https://leetcode.com/problems/design-underground-system "设计地铁系统") | [Go](problems/design-underground-system) | Medium |
6776
| <span id="1395">1395</span> | [Count Number of Teams](https://leetcode.com/problems/count-number-of-teams "统计作战单位数") | [Go](problems/count-number-of-teams) | Medium |
6877
| <span id="1394">1394</span> | [Find Lucky Integer in an Array](https://leetcode.com/problems/find-lucky-integer-in-an-array "找出数组中的幸运数") | [Go](problems/find-lucky-integer-in-an-array) | Easy |
69-
| <span id="1393">1393</span> | [Capital Gain/Loss](https://leetcode.com/problems/capital-gainloss) 🔒 | [MySQL](problems/capital-gainloss) | Medium |
78+
| <span id="1393">1393</span> | [Capital Gain/Loss](https://leetcode.com/problems/capital-gainloss "股票的资本损益") 🔒 | [MySQL](problems/capital-gainloss) | Medium |
7079
| <span id="1392">1392</span> | [Longest Happy Prefix](https://leetcode.com/problems/longest-happy-prefix "最长快乐前缀") | [Go](problems/longest-happy-prefix) | Hard |
7180
| <span id="1391">1391</span> | [Check if There is a Valid Path in a Grid](https://leetcode.com/problems/check-if-there-is-a-valid-path-in-a-grid "检查网格中是否存在有效路径") | [Go](problems/check-if-there-is-a-valid-path-in-a-grid) | Medium |
7281
| <span id="1390">1390</span> | [Four Divisors](https://leetcode.com/problems/four-divisors "四因数") | [Go](problems/four-divisors) | Medium |

problems/add-binary/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@
2727
<strong>Input:</strong> a = &quot;1010&quot;, b = &quot;1011&quot;
2828
<strong>Output:</strong> &quot;10101&quot;</pre>
2929

30+
<p>&nbsp;</p>
31+
<p><strong>Constraints:</strong></p>
32+
33+
<ul>
34+
<li>Each string consists only of <code>&#39;0&#39;</code> or <code>&#39;1&#39;</code> characters.</li>
35+
<li><code>1 &lt;= a.length, b.length &lt;= 10^4</code></li>
36+
<li>Each string is either <code>&quot;0&quot;</code> or doesn&#39;t contain any leading zero.</li>
37+
</ul>
38+
3039
### Related Topics
3140
[[Math](../../tag/math/README.md)]
3241
[[String](../../tag/string/README.md)]

problems/capital-gainloss/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99

1010
[Next >](../find-lucky-integer-in-an-array "Find Lucky Integer in an Array")
1111

12-
## [1393. Capital Gain/Loss (Medium)](https://leetcode.com/problems/capital-gainloss "")
12+
## [1393. Capital Gain/Loss (Medium)](https://leetcode.com/problems/capital-gainloss "股票的资本损益")
1313

1414

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
2+
<!--+----------------------------------------------------------------------+-->
3+
<!--|@author openset <openset.wang@gmail.com> |-->
4+
<!--|@link https://github.com/openset |-->
5+
<!--|@home https://github.com/openset/leetcode |-->
6+
<!--+----------------------------------------------------------------------+-->
7+
8+
[< Previous](../construct-k-palindrome-strings "Construct K Palindrome Strings")
9+
                
10+
[Next >](../reducing-dishes "Reducing Dishes")
11+
12+
## [1401. Circle and Rectangle Overlapping (Medium)](https://leetcode.com/problems/circle-and-rectangle-overlapping "圆和矩形是否有重叠")
13+
14+
<p>Given a circle represented as (<code>radius</code>, <code>x_center</code>, <code>y_center</code>)&nbsp;and an axis-aligned rectangle represented as (<code>x1</code>, <code>y1</code>, <code>x2</code>, <code>y2</code>),&nbsp;where (<code>x1</code>, <code>y1</code>) are the coordinates of the bottom-left corner, and (<code>x2</code>, <code>y2</code>) are the coordinates of the top-right corner of the&nbsp;rectangle.</p>
15+
16+
<p>Return True if the circle and rectangle are overlapped otherwise return False.</p>
17+
18+
<p>In other words, check if there are <strong>any </strong>point&nbsp;(xi, yi) such that belongs to the circle and the rectangle at the same time.</p>
19+
20+
<p>&nbsp;</p>
21+
<p><strong>Example 1:</strong></p>
22+
23+
<p><img alt="" src="https://assets.leetcode.com/uploads/2020/02/20/sample_4_1728.png" style="width: 258px; height: 167px;" /></p>
24+
25+
<pre>
26+
<strong>Input:</strong> radius = 1, x_center = 0, y_center = 0, x1 = 1, y1 = -1, x2 = 3, y2 = 1
27+
<strong>Output:</strong> true
28+
<strong>Explanation:</strong> Circle and rectangle share the point (1,0)
29+
</pre>
30+
31+
<p><strong>Example 2:</strong></p>
32+
33+
<p><strong><img alt="" src="https://assets.leetcode.com/uploads/2020/02/20/sample_2_1728.png" style="width: 150px; height: 135px;" /></strong></p>
34+
35+
<pre>
36+
<strong>Input:</strong> radius = 1, x_center = 0, y_center = 0, x1 = -1, y1 = 0, x2 = 0, y2 = 1
37+
<strong>Output:</strong> true
38+
</pre>
39+
40+
<p><strong>Example 3:</strong></p>
41+
42+
<p><strong><img alt="" src="https://assets.leetcode.com/uploads/2020/03/03/sample_6_1728.png" style="width: 175px; height: 165px;" /></strong></p>
43+
44+
<pre>
45+
<strong>Input:</strong> radius = 1, x_center = 1, y_center = 1, x1 = -3, y1 = -3, x2 = 3, y2 = 3
46+
<strong>Output:</strong> true
47+
</pre>
48+
49+
<p><strong>Example 4:</strong></p>
50+
51+
<pre>
52+
<strong>Input:</strong> radius = 1, x_center = 1, y_center = 1, x1 = 1, y1 = -3, x2 = 2, y2 = -1
53+
<strong>Output:</strong> false
54+
</pre>
55+
56+
<p>&nbsp;</p>
57+
<p><strong>Constraints:</strong></p>
58+
59+
<ul>
60+
<li><code>1 &lt;= radius &lt;= 2000</code></li>
61+
<li><code>-10^4 &lt;= x_center, y_center, x1, y1, x2, y2 &lt;= 10^4</code></li>
62+
<li><code>x1 &lt; x2</code></li>
63+
<li><code>y1 &lt; y2</code></li>
64+
</ul>
65+
66+
### Related Topics
67+
[[Geometry](../../tag/geometry/README.md)]
68+
69+
### Hints
70+
<details>
71+
<summary>Hint 1</summary>
72+
Locate the closest point of the square to the circle, you can then find the distance from this point to the center of the circle and check if this is less than or equal to the radius.
73+
</details>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
2+
<!--+----------------------------------------------------------------------+-->
3+
<!--|@author openset <openset.wang@gmail.com> |-->
4+
<!--|@link https://github.com/openset |-->
5+
<!--|@home https://github.com/openset/leetcode |-->
6+
<!--+----------------------------------------------------------------------+-->
7+
8+
[< Previous](../count-largest-group "Count Largest Group")
9+
                
10+
[Next >](../circle-and-rectangle-overlapping "Circle and Rectangle Overlapping")
11+
12+
## [1400. Construct K Palindrome Strings (Medium)](https://leetcode.com/problems/construct-k-palindrome-strings "构造 K 个回文字符串")
13+
14+
<p>Given a string <code>s</code> and an integer <code>k</code>. You should construct <code>k</code> non-empty <strong>palindrome</strong> strings using <strong>all the characters</strong> in <code>s</code>.</p>
15+
16+
<p>Return <em><strong>True</strong></em> if you can use all the characters in <code>s</code> to construct <code>k</code> palindrome strings or <em><strong>False</strong></em> otherwise.</p>
17+
18+
<p>&nbsp;</p>
19+
<p><strong>Example 1:</strong></p>
20+
21+
<pre>
22+
<strong>Input:</strong> s = &quot;annabelle&quot;, k = 2
23+
<strong>Output:</strong> true
24+
<strong>Explanation:</strong> You can construct two palindromes using all characters in s.
25+
Some possible constructions &quot;anna&quot; + &quot;elble&quot;, &quot;anbna&quot; + &quot;elle&quot;, &quot;anellena&quot; + &quot;b&quot;
26+
</pre>
27+
28+
<p><strong>Example 2:</strong></p>
29+
30+
<pre>
31+
<strong>Input:</strong> s = &quot;leetcode&quot;, k = 3
32+
<strong>Output:</strong> false
33+
<strong>Explanation:</strong> It is impossible to construct 3 palindromes using all the characters of s.
34+
</pre>
35+
36+
<p><strong>Example 3:</strong></p>
37+
38+
<pre>
39+
<strong>Input:</strong> s = &quot;true&quot;, k = 4
40+
<strong>Output:</strong> true
41+
<strong>Explanation:</strong> The only possible solution is to put each character in a separate string.
42+
</pre>
43+
44+
<p><strong>Example 4:</strong></p>
45+
46+
<pre>
47+
<strong>Input:</strong> s = &quot;yzyzyzyzyzyzyzy&quot;, k = 2
48+
<strong>Output:</strong> true
49+
<strong>Explanation:</strong> Simply you can put all z&#39;s in one string and all y&#39;s in the other string. Both strings will be palindrome.
50+
</pre>
51+
52+
<p><strong>Example 5:</strong></p>
53+
54+
<pre>
55+
<strong>Input:</strong> s = &quot;cr&quot;, k = 7
56+
<strong>Output:</strong> false
57+
<strong>Explanation:</strong> We don&#39;t have enough characters in s to construct 7 palindromes.
58+
</pre>
59+
60+
<p>&nbsp;</p>
61+
<p><strong>Constraints:</strong></p>
62+
63+
<ul>
64+
<li><code>1 &lt;= s.length &lt;= 10^5</code></li>
65+
<li>All characters in <code>s</code> are lower-case English letters.</li>
66+
<li><code>1 &lt;= k &lt;= 10^5</code></li>
67+
</ul>
68+
69+
### Related Topics
70+
[[Greedy](../../tag/greedy/README.md)]
71+
72+
### Hints
73+
<details>
74+
<summary>Hint 1</summary>
75+
If the s.length < k we cannot construct k strings from s and answer is false.
76+
</details>
77+
78+
<details>
79+
<summary>Hint 2</summary>
80+
If the number of characters that have odd counts is > k then the minimum number of palindrome strings we can construct is > k and answer is false.
81+
</details>
82+
83+
<details>
84+
<summary>Hint 3</summary>
85+
Otherwise you can construct exactly k palindrome strings and answer is true (why ?).
86+
</details>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
2+
<!--+----------------------------------------------------------------------+-->
3+
<!--|@author openset <openset.wang@gmail.com> |-->
4+
<!--|@link https://github.com/openset |-->
5+
<!--|@home https://github.com/openset/leetcode |-->
6+
<!--+----------------------------------------------------------------------+-->
7+
8+
[< Previous](../customers-who-bought-products-a-and-b-but-not-c "Customers Who Bought Products A and B but Not C")
9+
                
10+
[Next >](../construct-k-palindrome-strings "Construct K Palindrome Strings")
11+
12+
## [1399. Count Largest Group (Easy)](https://leetcode.com/problems/count-largest-group "统计最大组的数目")
13+
14+
<p>Given an integer&nbsp;<code>n</code>.&nbsp;Each number from <code>1</code> to <code>n</code> is grouped according to the sum of its digits.&nbsp;</p>
15+
16+
<p>Return&nbsp;how many groups have the largest size.</p>
17+
18+
<p>&nbsp;</p>
19+
<p><strong>Example 1:</strong></p>
20+
21+
<pre>
22+
<strong>Input:</strong> n = 13
23+
<strong>Output:</strong> 4
24+
<strong>Explanation:</strong> There are 9 groups in total, they are grouped according sum of its digits of numbers from 1 to 13:
25+
[1,10], [2,11], [3,12], [4,13], [5], [6], [7], [8], [9]. There are 4 groups with largest size.
26+
</pre>
27+
28+
<p><strong>Example 2:</strong></p>
29+
30+
<pre>
31+
<strong>Input:</strong> n = 2
32+
<strong>Output:</strong> 2
33+
<strong>Explanation:</strong> There are 2 groups [1], [2] of size 1.
34+
</pre>
35+
36+
<p><strong>Example 3:</strong></p>
37+
38+
<pre>
39+
<strong>Input:</strong> n = 15
40+
<strong>Output:</strong> 6
41+
</pre>
42+
43+
<p><strong>Example 4:</strong></p>
44+
45+
<pre>
46+
<strong>Input:</strong> n = 24
47+
<strong>Output:</strong> 5
48+
</pre>
49+
50+
<p>&nbsp;</p>
51+
<p><strong>Constraints:</strong></p>
52+
53+
<ul>
54+
<li><code>1 &lt;= n &lt;= 10^4</code></li>
55+
</ul>
56+
57+
### Related Topics
58+
[[Array](../../tag/array/README.md)]
59+
60+
### Hints
61+
<details>
62+
<summary>Hint 1</summary>
63+
Count the digit sum for each integer in the range and find out the largest groups.
64+
</details>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
2+
<!--+----------------------------------------------------------------------+-->
3+
<!--|@author openset <openset.wang@gmail.com> |-->
4+
<!--|@link https://github.com/openset |-->
5+
<!--|@home https://github.com/openset/leetcode |-->
6+
<!--+----------------------------------------------------------------------+-->
7+
8+
[< Previous](../find-all-good-strings "Find All Good Strings")
9+
                
10+
[Next >](../count-largest-group "Count Largest Group")
11+
12+
## [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 "")
13+
14+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Create table If Not Exists Customers (customer_id int, customer_name varchar(30));
2+
Create table If Not Exists Orders (order_id int, customer_id int, product_name varchar(30));
3+
Truncate table Customers;
4+
insert into Customers (customer_id, customer_name) values ('1', 'Daniel');
5+
insert into Customers (customer_id, customer_name) values ('2', 'Diana');
6+
insert into Customers (customer_id, customer_name) values ('3', 'Elizabeth');
7+
insert into Customers (customer_id, customer_name) values ('4', 'Jhon');
8+
Truncate table Orders;
9+
insert into Orders (order_id, customer_id, product_name) values ('10', '1', 'A');
10+
insert into Orders (order_id, customer_id, product_name) values ('20', '1', 'B');
11+
insert into Orders (order_id, customer_id, product_name) values ('30', '1', 'D');
12+
insert into Orders (order_id, customer_id, product_name) values ('40', '1', 'C');
13+
insert into Orders (order_id, customer_id, product_name) values ('50', '2', 'A');
14+
insert into Orders (order_id, customer_id, product_name) values ('60', '3', 'A');
15+
insert into Orders (order_id, customer_id, product_name) values ('70', '3', 'B');
16+
insert into Orders (order_id, customer_id, product_name) values ('80', '3', 'D');
17+
insert into Orders (order_id, customer_id, product_name) values ('90', '4', 'C');

problems/design-underground-system/README.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838

3939
<p>&nbsp;</p>
4040
<p><strong>Example 1:</strong></p>
41+
<strong>Input</strong>
4142

4243
<pre>
43-
<strong>Input</strong>
4444
[&quot;UndergroundSystem&quot;,&quot;checkIn&quot;,&quot;checkIn&quot;,&quot;checkIn&quot;,&quot;checkOut&quot;,&quot;checkOut&quot;,&quot;checkOut&quot;,&quot;getAverageTime&quot;,&quot;getAverageTime&quot;,&quot;checkIn&quot;,&quot;getAverageTime&quot;,&quot;checkOut&quot;,&quot;getAverageTime&quot;]
4545
[[],[45,&quot;Leyton&quot;,3],[32,&quot;Paradise&quot;,8],[27,&quot;Leyton&quot;,10],[45,&quot;Waterloo&quot;,15],[27,&quot;Waterloo&quot;,20],[32,&quot;Cambridge&quot;,22],[&quot;Paradise&quot;,&quot;Cambridge&quot;],[&quot;Leyton&quot;,&quot;Waterloo&quot;],[10,&quot;Leyton&quot;,24],[&quot;Leyton&quot;,&quot;Waterloo&quot;],[10,&quot;Waterloo&quot;,38],[&quot;Leyton&quot;,&quot;Waterloo&quot;]]
4646

4747
<strong>Output</strong>
48-
[null,null,null,null,null,null,null,14.0,11.0,null,11.0,null,12.0]
48+
[null,null,null,null,null,null,null,14.00000,11.00000,null,11.00000,null,12.00000]
4949

5050
<strong>Explanation</strong>
5151
UndergroundSystem undergroundSystem = new UndergroundSystem();
@@ -55,12 +55,36 @@ undergroundSystem.checkIn(27, &quot;Leyton&quot;, 10);
5555
undergroundSystem.checkOut(45, &quot;Waterloo&quot;, 15);
5656
undergroundSystem.checkOut(27, &quot;Waterloo&quot;, 20);
5757
undergroundSystem.checkOut(32, &quot;Cambridge&quot;, 22);
58-
undergroundSystem.getAverageTime(&quot;Paradise&quot;, &quot;Cambridge&quot;); // return 14.0. There was only one travel from &quot;Paradise&quot; (at time 8) to &quot;Cambridge&quot; (at time 22)
59-
undergroundSystem.getAverageTime(&quot;Leyton&quot;, &quot;Waterloo&quot;); // return 11.0. There were two travels from &quot;Leyton&quot; to &quot;Waterloo&quot;, a customer with id=45 from time=3 to time=15 and a customer with id=27 from time=10 to time=20. So the average time is ( (15-3) + (20-10) ) / 2 = 11.0
58+
undergroundSystem.getAverageTime(&quot;Paradise&quot;, &quot;Cambridge&quot;); &nbsp; &nbsp; &nbsp; // return 14.00000. There was only one travel from &quot;Paradise&quot; (at time 8) to &quot;Cambridge&quot; (at time 22)
59+
undergroundSystem.getAverageTime(&quot;Leyton&quot;, &quot;Waterloo&quot;); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// return 11.00000. There were two travels from &quot;Leyton&quot; to &quot;Waterloo&quot;, a customer with id=45 from time=3 to time=15 and a customer with id=27 from time=10 to time=20. So the average time is ( (15-3) + (20-10) ) / 2 = 11.00000
6060
undergroundSystem.checkIn(10, &quot;Leyton&quot;, 24);
61-
undergroundSystem.getAverageTime(&quot;Leyton&quot;, &quot;Waterloo&quot;); // return 11.0
61+
undergroundSystem.getAverageTime(&quot;Leyton&quot;, &quot;Waterloo&quot;); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// return 11.00000
6262
undergroundSystem.checkOut(10, &quot;Waterloo&quot;, 38);
63-
undergroundSystem.getAverageTime(&quot;Leyton&quot;, &quot;Waterloo&quot;); // return 12.0</pre>
63+
undergroundSystem.getAverageTime(&quot;Leyton&quot;, &quot;Waterloo&quot;); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// return 12.00000
64+
</pre>
65+
66+
<p><strong>Example 2:</strong></p>
67+
<strong>Input</strong>
68+
69+
<pre>
70+
[&quot;UndergroundSystem&quot;,&quot;checkIn&quot;,&quot;checkOut&quot;,&quot;getAverageTime&quot;,&quot;checkIn&quot;,&quot;checkOut&quot;,&quot;getAverageTime&quot;,&quot;checkIn&quot;,&quot;checkOut&quot;,&quot;getAverageTime&quot;]
71+
[[],[10,&quot;Leyton&quot;,3],[10,&quot;Paradise&quot;,8],[&quot;Leyton&quot;,&quot;Paradise&quot;],[5,&quot;Leyton&quot;,10],[5,&quot;Paradise&quot;,16],[&quot;Leyton&quot;,&quot;Paradise&quot;],[2,&quot;Leyton&quot;,21],[2,&quot;Paradise&quot;,30],[&quot;Leyton&quot;,&quot;Paradise&quot;]]
72+
73+
<strong>Output</strong>
74+
[null,null,null,5.00000,null,null,5.50000,null,null,6.66667]
75+
76+
<strong>Explanation</strong>
77+
UndergroundSystem undergroundSystem = new UndergroundSystem();
78+
undergroundSystem.checkIn(10, &quot;Leyton&quot;, 3);
79+
undergroundSystem.checkOut(10, &quot;Paradise&quot;, 8);
80+
undergroundSystem.getAverageTime(&quot;Leyton&quot;, &quot;Paradise&quot;); // return 5.00000
81+
undergroundSystem.checkIn(5, &quot;Leyton&quot;, 10);
82+
undergroundSystem.checkOut(5, &quot;Paradise&quot;, 16);
83+
undergroundSystem.getAverageTime(&quot;Leyton&quot;, &quot;Paradise&quot;); // return 5.50000
84+
undergroundSystem.checkIn(2, &quot;Leyton&quot;, 21);
85+
undergroundSystem.checkOut(2, &quot;Paradise&quot;, 30);
86+
undergroundSystem.getAverageTime(&quot;Leyton&quot;, &quot;Paradise&quot;); // return 6.66667
87+
</pre>
6488

6589
<p>&nbsp;</p>
6690
<p><strong>Constraints:</strong></p>

0 commit comments

Comments
 (0)