Skip to content

Commit ca31a03

Browse files
committed
feat: add solutions to lc problems: No.1119,1132
* No.1119. Remove Vowels from a String * No.1132. Reported Posts II
1 parent 2ec8521 commit ca31a03

File tree

8 files changed

+67
-18
lines changed

8 files changed

+67
-18
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function removeVowels(s: string): string {
2+
return s.replace(/[aeiou]/g, '');
3+
}

solution/1100-1199/1132.Reported Posts II/README.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,21 @@ Removals table:
9797
### **SQL**
9898

9999
```sql
100-
100+
# Write your MySQL query statement below
101+
SELECT
102+
round( avg( avg_per * 100 ), 2 ) AS average_daily_percent
103+
FROM
104+
(
105+
SELECT
106+
count( DISTINCT t2.post_id ) / count( DISTINCT t1.post_id ) AS avg_per
107+
FROM
108+
Actions t1
109+
LEFT JOIN Removals t2 ON t1.post_id = t2.post_id
110+
WHERE
111+
t1.extra = 'spam'
112+
GROUP BY
113+
action_date
114+
) t3;
101115
```
102116

103117
<!-- tabs:end -->

solution/1100-1199/1132.Reported Posts II/README_EN.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,21 @@ Note that the output is only one number and that we do not care about the remove
9292
### **SQL**
9393

9494
```sql
95-
95+
# Write your MySQL query statement below
96+
SELECT
97+
round( avg( avg_per * 100 ), 2 ) AS average_daily_percent
98+
FROM
99+
(
100+
SELECT
101+
count( DISTINCT t2.post_id ) / count( DISTINCT t1.post_id ) AS avg_per
102+
FROM
103+
Actions t1
104+
LEFT JOIN Removals t2 ON t1.post_id = t2.post_id
105+
WHERE
106+
t1.extra = 'spam'
107+
GROUP BY
108+
action_date
109+
) t3;
96110
```
97111

98112
<!-- tabs:end -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Write your MySQL query statement below
2+
SELECT
3+
round( avg( avg_per * 100 ), 2 ) AS average_daily_percent
4+
FROM
5+
(
6+
SELECT
7+
count( DISTINCT t2.post_id ) / count( DISTINCT t1.post_id ) AS avg_per
8+
FROM
9+
Actions t1
10+
LEFT JOIN Removals t2 ON t1.post_id = t2.post_id
11+
WHERE
12+
t1.extra = 'spam'
13+
GROUP BY
14+
action_date
15+
) t3;

solution/1100-1199/1137.N-th Tribonacci Number/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ T_4 = 1 + 1 + 2 = 4
4444

4545
**方法一:动态规划**
4646

47-
由于题目中给出的递推式,可以使用动态规划求解
47+
根据题目中给出的递推式,我们可以使用动态规划求解
4848

4949
我们定义三个变量 $a$, $b$, $c$,分别表示 $T_{n-3}$, $T_{n-2}$, $T_{n-1}$,初始值分别为 $0$, $1$, $1$。
5050

solution/1100-1199/1141.User Activity for the Past 30 Days I/README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,15 @@ Activity table:
7272

7373
```sql
7474
SELECT
75-
activity_date AS day,
76-
COUNT(DISTINCT user_id) AS active_users
75+
activity_date AS DAY,
76+
COUNT( DISTINCT user_id ) AS active_users
7777
FROM
78-
Activity
78+
Activity
7979
WHERE
80-
DATEDIFF('2019-07-27', activity_date) < 30
80+
DATEDIFF( '2019-07-27', activity_date ) > 0
81+
AND DATEDIFF( '2019-07-27', activity_date ) < 30
8182
GROUP BY
82-
activity_date;
83+
activity_date;
8384
```
8485

8586
<!-- tabs:end -->

solution/1100-1199/1141.User Activity for the Past 30 Days I/README_EN.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,15 @@ Activity table:
6868

6969
```sql
7070
SELECT
71-
activity_date AS day,
72-
COUNT(DISTINCT user_id) AS active_users
71+
activity_date AS DAY,
72+
COUNT( DISTINCT user_id ) AS active_users
7373
FROM
74-
Activity
74+
Activity
7575
WHERE
76-
DATEDIFF('2019-07-27', activity_date) < 30
76+
DATEDIFF( '2019-07-27', activity_date ) > 0
77+
AND DATEDIFF( '2019-07-27', activity_date ) < 30
7778
GROUP BY
78-
activity_date;
79+
activity_date;
7980
```
8081

8182
<!-- tabs:end -->
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
SELECT
2-
activity_date AS day,
3-
COUNT(DISTINCT user_id) AS active_users
2+
activity_date AS DAY,
3+
COUNT( DISTINCT user_id ) AS active_users
44
FROM
5-
Activity
5+
Activity
66
WHERE
7-
DATEDIFF('2019-07-27', activity_date) < 30
7+
DATEDIFF( '2019-07-27', activity_date ) > 0
8+
AND DATEDIFF( '2019-07-27', activity_date ) < 30
89
GROUP BY
9-
activity_date;
10+
activity_date;

0 commit comments

Comments
 (0)