Skip to content

Commit c0174c5

Browse files
committed
feat: add solutions to lc problems: No.2686,2687
* No.2686.Immediate Food Delivery III * No.2687.Bikes Last Time Used
1 parent b9cba6c commit c0174c5

File tree

18 files changed

+69
-79
lines changed

18 files changed

+69
-79
lines changed

solution/0800-0899/0839.Similar String Groups/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Description
66

7-
<p>Two strings <code>X</code>&nbsp;and <code>Y</code>&nbsp;are similar if we can swap two letters (in different positions) of <code>X</code>, so that&nbsp;it equals <code>Y</code>. Also two strings <code>X</code> and <code>Y</code> are similar if they are equal.</p>
7+
<p>Two strings, <code>X</code> and <code>Y</code>, are considered similar if either they are identical or we can make them equivalent by swapping at most two letters (in distinct positions) within the string <code>X</code>.</p>
88

99
<p>For example, <code>&quot;tars&quot;</code>&nbsp;and <code>&quot;rats&quot;</code>&nbsp;are similar (swapping at positions <code>0</code> and <code>2</code>), and <code>&quot;rats&quot;</code> and <code>&quot;arts&quot;</code> are similar, but <code>&quot;star&quot;</code> is not similar to <code>&quot;tars&quot;</code>, <code>&quot;rats&quot;</code>, or <code>&quot;arts&quot;</code>.</p>
1010

solution/2600-2699/2684.Maximum Number of Moves in a Grid/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<p>&nbsp;</p>
2020

2121
<p><strong>示例 1:</strong></p>
22-
<img alt="" src="https://assets.leetcode.com/uploads/2023/04/11/yetgriddrawio-10.png" style="width: 201px; height: 201px;">
22+
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2600-2699/2684.Maximum%20Number%20of%20Moves%20in%20a%20Grid/images/yetgriddrawio-10.png" style="width: 201px; height: 201px;">
2323
<pre><strong>输入:</strong>grid = [[2,4,3,5],[5,4,9,3],[3,4,2,11],[10,9,13,15]]
2424
<strong>输出:</strong>3
2525
<strong>解释:</strong>可以从单元格 (0, 0) 开始并且按下面的路径移动:
@@ -30,7 +30,7 @@
3030

3131
<p><strong>示例 2:</strong></p>
3232

33-
<pre><img alt="" src="https://assets.leetcode.com/uploads/2023/04/12/yetgrid4drawio.png">
33+
<pre><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2600-2699/2684.Maximum%20Number%20of%20Moves%20in%20a%20Grid/images/yetgrid4drawio.png">
3434
<strong>输入:</strong>grid = [[3,2,4],[2,1,9],[1,1,7]]
3535
<strong>输出:</strong>0
3636
<strong>解释:</strong>从第一列的任一单元格开始都无法移动。

solution/2600-2699/2684.Maximum Number of Moves in a Grid/README_EN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<p>&nbsp;</p>
1818
<p><strong class="example">Example 1:</strong></p>
19-
<img alt="" src="https://assets.leetcode.com/uploads/2023/04/11/yetgriddrawio-10.png" style="width: 201px; height: 201px;" />
19+
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2600-2699/2684.Maximum%20Number%20of%20Moves%20in%20a%20Grid/images/yetgriddrawio-10.png" style="width: 201px; height: 201px;" />
2020
<pre>
2121
<strong>Input:</strong> grid = [[2,4,3,5],[5,4,9,3],[3,4,2,11],[10,9,13,15]]
2222
<strong>Output:</strong> 3
@@ -29,7 +29,7 @@ It can be shown that it is the maximum number of moves that can be made.</pre>
2929
<p><strong class="example">Example 2:</strong></p>
3030

3131
<pre>
32-
<img alt="" src="https://assets.leetcode.com/uploads/2023/04/12/yetgrid4drawio.png" />
32+
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2600-2699/2684.Maximum%20Number%20of%20Moves%20in%20a%20Grid/images/yetgrid4drawio.png" />
3333
<strong>Input:</strong> grid = [[3,2,4],[2,1,9],[1,1,7]]
3434
<strong>Output:</strong> 0
3535
<strong>Explanation:</strong> Starting from any cell in the first column we cannot perform any moves.

solution/2600-2699/2685.Count the Number of Complete Components/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
<p><strong>示例 1:</strong></p>
2020

21-
<p><strong><img alt="" src="https://assets.leetcode.com/uploads/2023/04/11/screenshot-from-2023-04-11-23-31-23.png" style="width: 671px; height: 270px;" /></strong></p>
21+
<p><strong><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2600-2699/2685.Count%20the%20Number%20of%20Complete%20Components/images/screenshot-from-2023-04-11-23-31-23.png" style="width: 671px; height: 270px;" /></strong></p>
2222

2323
<pre>
2424
<strong>输入:</strong>n = 6, edges = [[0,1],[0,2],[1,2],[3,4]]
@@ -28,7 +28,7 @@
2828

2929
<p><strong>示例 2:</strong></p>
3030

31-
<p><strong><img alt="" src="https://assets.leetcode.com/uploads/2023/04/11/screenshot-from-2023-04-11-23-32-00.png" style="width: 671px; height: 270px;" /></strong></p>
31+
<p><strong><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2600-2699/2685.Count%20the%20Number%20of%20Complete%20Components/images/screenshot-from-2023-04-11-23-32-00.png" style="width: 671px; height: 270px;" /></strong></p>
3232

3333
<pre>
3434
<strong>输入:</strong>n = 6, edges = [[0,1],[0,2],[1,2],[3,4],[3,5]]

solution/2600-2699/2685.Count the Number of Complete Components/README_EN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<p>&nbsp;</p>
1616
<p><strong class="example">Example 1:</strong></p>
1717

18-
<p><strong class="example"><img alt="" src="https://assets.leetcode.com/uploads/2023/04/11/screenshot-from-2023-04-11-23-31-23.png" style="width: 671px; height: 270px;" /></strong></p>
18+
<p><strong class="example"><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2600-2699/2685.Count%20the%20Number%20of%20Complete%20Components/images/screenshot-from-2023-04-11-23-31-23.png" style="width: 671px; height: 270px;" /></strong></p>
1919

2020
<pre>
2121
<strong>Input:</strong> n = 6, edges = [[0,1],[0,2],[1,2],[3,4]]
@@ -25,7 +25,7 @@
2525

2626
<p><strong class="example">Example 2:</strong></p>
2727

28-
<p><strong class="example"><img alt="" src="https://assets.leetcode.com/uploads/2023/04/11/screenshot-from-2023-04-11-23-32-00.png" style="width: 671px; height: 270px;" /></strong></p>
28+
<p><strong class="example"><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2600-2699/2685.Count%20the%20Number%20of%20Complete%20Components/images/screenshot-from-2023-04-11-23-32-00.png" style="width: 671px; height: 270px;" /></strong></p>
2929

3030
<pre>
3131
<strong>Input:</strong> n = 6, edges = [[0,1],[0,2],[1,2],[3,4],[3,5]]

solution/2600-2699/2686.Immediate Food Delivery III/README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ Delivery table:
6666
order_date is sorted in ascending order.
6767
</pre>
6868

69-
7069
## 解法
7170

7271
<!-- 这里可写通用的实现逻辑 -->
@@ -78,7 +77,12 @@ order_date is sorted in ascending order.
7877
<!-- 这里可写当前语言的特殊实现逻辑 -->
7978

8079
```sql
81-
80+
# Write your MySQL query statement below
81+
SELECT order_date
82+
,round(100*SUM(IF(customer_pref_delivery_date = order_date,1,0))/COUNT(*),2) AS immediate_percentage
83+
FROM Delivery
84+
GROUP BY order_date
85+
ORDER BY order_date
8286
```
8387

84-
<!-- tabs:end -->
88+
<!-- tabs:end -->

solution/2600-2699/2686.Immediate Food Delivery III/README_EN.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,19 @@ Delivery table:
6464
order_date is sorted in ascending order.
6565
</pre>
6666

67-
6867
## Solutions
6968

7069
<!-- tabs:start -->
7170

7271
### **SQL**
7372

7473
```sql
75-
74+
# Write your MySQL query statement below
75+
SELECT order_date
76+
,round(100*SUM(IF(customer_pref_delivery_date = order_date,1,0))/COUNT(*),2) AS immediate_percentage
77+
FROM Delivery
78+
GROUP BY order_date
79+
ORDER BY order_date
7680
```
7781

78-
<!-- tabs:end -->
82+
<!-- tabs:end -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Write your MySQL query statement below
2+
SELECT order_date
3+
,round(100*SUM(IF(customer_pref_delivery_date = order_date,1,0))/COUNT(*),2) AS immediate_percentage
4+
FROM Delivery
5+
GROUP BY order_date
6+
ORDER BY order_date

solution/2600-2699/2687.Bikes Last Time Used/README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ Returning output in order by the bike that were most recently used.
6161

6262
<p>&nbsp;</p>
6363

64-
6564
## 解法
6665

6766
<!-- 这里可写通用的实现逻辑 -->
@@ -73,7 +72,12 @@ Returning output in order by the bike that were most recently used.
7372
<!-- 这里可写当前语言的特殊实现逻辑 -->
7473

7574
```sql
76-
75+
# Write your MySQL query statement below
76+
SELECT bike_number
77+
,MAX(end_time) AS end_time
78+
FROM Bikes
79+
GROUP BY bike_number
80+
ORDER BY end_time DESC
7781
```
7882

79-
<!-- tabs:end -->
83+
<!-- tabs:end -->

solution/2600-2699/2687.Bikes Last Time Used/README_EN.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,19 @@ Returning output in order by the bike that were most recently used.
5959

6060
<p>&nbsp;</p>
6161

62-
6362
## Solutions
6463

6564
<!-- tabs:start -->
6665

6766
### **SQL**
6867

6968
```sql
70-
69+
# Write your MySQL query statement below
70+
SELECT bike_number
71+
,MAX(end_time) AS end_time
72+
FROM Bikes
73+
GROUP BY bike_number
74+
ORDER BY end_time DESC
7175
```
7276

73-
<!-- tabs:end -->
77+
<!-- tabs:end -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Write your MySQL query statement below
2+
SELECT bike_number
3+
,MAX(end_time) AS end_time
4+
FROM Bikes
5+
GROUP BY bike_number
6+
ORDER BY end_time DESC

solution/2600-2699/2688.Find Active Users/README.md

+3-30
Original file line numberDiff line numberDiff line change
@@ -58,45 +58,18 @@ Each row includes the user ID, the purchased item, the date of purchase, and the
5858
- User with user_id 4 has two transaction his first transaction was on 2021-09-02 and second transation was on 2021-09-13. The distance between the first and second transactions date is &gt; 7 days. So he is not an active user.
5959
</pre>
6060

61-
6261
## 解法
6362

6463
<!-- 这里可写通用的实现逻辑 -->
6564

6665
<!-- tabs:start -->
6766

68-
### **Python3**
69-
70-
<!-- 这里可写当前语言的特殊实现逻辑 -->
71-
72-
```python
73-
74-
```
75-
76-
### **Java**
67+
### **SQL**
7768

7869
<!-- 这里可写当前语言的特殊实现逻辑 -->
7970

80-
```java
81-
82-
```
83-
84-
### **C++**
85-
86-
```cpp
87-
88-
```
89-
90-
### **Go**
91-
92-
```go
93-
94-
```
95-
96-
### **...**
97-
98-
```
71+
```sql
9972

10073
```
10174

102-
<!-- tabs:end -->
75+
<!-- tabs:end -->

solution/2600-2699/2688.Find Active Users/README_EN.md

+3-28
Original file line numberDiff line numberDiff line change
@@ -56,39 +56,14 @@ Each row includes the user ID, the purchased item, the date of purchase, and the
5656
- User with user_id 4 has two transaction his first transaction was on 2021-09-02 and second transation was on 2021-09-13. The distance between the first and second transactions date is &gt; 7 days. So he is not an active user.
5757
</pre>
5858

59-
6059
## Solutions
6160

6261
<!-- tabs:start -->
6362

64-
### **Python3**
65-
66-
```python
67-
68-
```
69-
70-
### **Java**
71-
72-
```java
73-
74-
```
75-
76-
### **C++**
63+
### **SQL**
7764

78-
```cpp
79-
80-
```
81-
82-
### **Go**
83-
84-
```go
85-
86-
```
87-
88-
### **...**
89-
90-
```
65+
```sql
9166

9267
```
9368

94-
<!-- tabs:end -->
69+
<!-- tabs:end -->

solution/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -2696,6 +2696,9 @@
26962696
| 2683 | [相邻值的按位异或](/solution/2600-2699/2683.Neighboring%20Bitwise%20XOR/README.md) | | 中等 | 第 345 场周赛 |
26972697
| 2684 | [矩阵中移动的最大次数](/solution/2600-2699/2684.Maximum%20Number%20of%20Moves%20in%20a%20Grid/README.md) | | 中等 | 第 345 场周赛 |
26982698
| 2685 | [统计完全连通分量的数量](/solution/2600-2699/2685.Count%20the%20Number%20of%20Complete%20Components/README.md) | | 中等 | 第 345 场周赛 |
2699+
| 2686 | [Immediate Food Delivery III](/solution/2600-2699/2686.Immediate%20Food%20Delivery%20III/README.md) | | 中等 | 🔒 |
2700+
| 2687 | [Bikes Last Time Used](/solution/2600-2699/2687.Bikes%20Last%20Time%20Used/README.md) | | 简单 | 🔒 |
2701+
| 2688 | [Find Active Users](/solution/2600-2699/2688.Find%20Active%20Users/README.md) | | 中等 | 🔒 |
26992702

27002703
## 版权
27012704

solution/README_EN.md

+3
Original file line numberDiff line numberDiff line change
@@ -2694,6 +2694,9 @@ Press <kbd>Control</kbd>+<kbd>F</kbd>(or <kbd>Command</kbd>+<kbd>F</kbd> on the
26942694
| 2683 | [Neighboring Bitwise XOR](/solution/2600-2699/2683.Neighboring%20Bitwise%20XOR/README_EN.md) | | Medium | Weekly Contest 345 |
26952695
| 2684 | [Maximum Number of Moves in a Grid](/solution/2600-2699/2684.Maximum%20Number%20of%20Moves%20in%20a%20Grid/README_EN.md) | | Medium | Weekly Contest 345 |
26962696
| 2685 | [Count the Number of Complete Components](/solution/2600-2699/2685.Count%20the%20Number%20of%20Complete%20Components/README_EN.md) | | Medium | Weekly Contest 345 |
2697+
| 2686 | [Immediate Food Delivery III](/solution/2600-2699/2686.Immediate%20Food%20Delivery%20III/README_EN.md) | | Medium | 🔒 |
2698+
| 2687 | [Bikes Last Time Used](/solution/2600-2699/2687.Bikes%20Last%20Time%20Used/README_EN.md) | | Easy | 🔒 |
2699+
| 2688 | [Find Active Users](/solution/2600-2699/2688.Find%20Active%20Users/README_EN.md) | | Medium | 🔒 |
26972700

26982701
## Copyright
26992702

solution/summary.md

+3
Original file line numberDiff line numberDiff line change
@@ -2737,3 +2737,6 @@
27372737
- [2683.相邻值的按位异或](/solution/2600-2699/2683.Neighboring%20Bitwise%20XOR/README.md)
27382738
- [2684.矩阵中移动的最大次数](/solution/2600-2699/2684.Maximum%20Number%20of%20Moves%20in%20a%20Grid/README.md)
27392739
- [2685.统计完全连通分量的数量](/solution/2600-2699/2685.Count%20the%20Number%20of%20Complete%20Components/README.md)
2740+
- [2686.Immediate Food Delivery III](/solution/2600-2699/2686.Immediate%20Food%20Delivery%20III/README.md)
2741+
- [2687.Bikes Last Time Used](/solution/2600-2699/2687.Bikes%20Last%20Time%20Used/README.md)
2742+
- [2688.Find Active Users](/solution/2600-2699/2688.Find%20Active%20Users/README.md)

solution/summary_en.md

+3
Original file line numberDiff line numberDiff line change
@@ -2737,3 +2737,6 @@
27372737
- [2683.Neighboring Bitwise XOR](/solution/2600-2699/2683.Neighboring%20Bitwise%20XOR/README_EN.md)
27382738
- [2684.Maximum Number of Moves in a Grid](/solution/2600-2699/2684.Maximum%20Number%20of%20Moves%20in%20a%20Grid/README_EN.md)
27392739
- [2685.Count the Number of Complete Components](/solution/2600-2699/2685.Count%20the%20Number%20of%20Complete%20Components/README_EN.md)
2740+
- [2686.Immediate Food Delivery III](/solution/2600-2699/2686.Immediate%20Food%20Delivery%20III/README_EN.md)
2741+
- [2687.Bikes Last Time Used](/solution/2600-2699/2687.Bikes%20Last%20Time%20Used/README_EN.md)
2742+
- [2688.Find Active Users](/solution/2600-2699/2688.Find%20Active%20Users/README_EN.md)

solution/util.py

+2
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ def generate_summary(result):
181181
for sub in sorted(os.listdir('./' + file), key=lambda x: x.lower()):
182182
sub = sub.replace('`', ' ')
183183
enc = quote(sub)
184+
if not sub[:4].isdigit():
185+
continue
184186
data = m.get(int(sub[:4]))
185187
sub_cn = sub
186188
if data:

0 commit comments

Comments
 (0)