Skip to content

Commit b750875

Browse files
committed
feat: add solutions to lc problems: No.1119,1683,1757,1821
1 parent 20e5b98 commit b750875

File tree

13 files changed

+129
-12
lines changed

13 files changed

+129
-12
lines changed

solution/1100-1199/1119.Remove Vowels from a String/README.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,31 @@
4343
<!-- 这里可写当前语言的特殊实现逻辑 -->
4444

4545
```python
46-
46+
class Solution:
47+
def removeVowels(self, s: str) -> str:
48+
res = []
49+
for c in s:
50+
if c not in {'a', 'e', 'i', 'o', 'u'}:
51+
res.append(c)
52+
return ''.join(res)
4753
```
4854

4955
### **Java**
5056

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

5359
```java
54-
60+
class Solution {
61+
public String removeVowels(String s) {
62+
StringBuilder res = new StringBuilder();
63+
for (char c : s.toCharArray()) {
64+
if (!(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')) {
65+
res.append(c);
66+
}
67+
}
68+
return res.toString();
69+
}
70+
}
5571
```
5672

5773
### **...**

solution/1100-1199/1119.Remove Vowels from a String/README_EN.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,29 @@
3737
### **Python3**
3838

3939
```python
40-
40+
class Solution:
41+
def removeVowels(self, s: str) -> str:
42+
res = []
43+
for c in s:
44+
if c not in {'a', 'e', 'i', 'o', 'u'}:
45+
res.append(c)
46+
return ''.join(res)
4147
```
4248

4349
### **Java**
4450

4551
```java
46-
52+
class Solution {
53+
public String removeVowels(String s) {
54+
StringBuilder res = new StringBuilder();
55+
for (char c : s.toCharArray()) {
56+
if (!(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')) {
57+
res.append(c);
58+
}
59+
}
60+
return res.toString();
61+
}
62+
}
4763
```
4864

4965
### **...**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
public String removeVowels(String s) {
3+
StringBuilder res = new StringBuilder();
4+
for (char c : s.toCharArray()) {
5+
if (!(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')) {
6+
res.append(c);
7+
}
8+
}
9+
return res.toString();
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Solution:
2+
def removeVowels(self, s: str) -> str:
3+
res = []
4+
for c in s:
5+
if c not in {'a', 'e', 'i', 'o', 'u'}:
6+
res.append(c)
7+
return ''.join(res)

solution/1600-1699/1683.Invalid Tweets/README.md

+13-3
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,27 @@ tweet_id 是这个表的主键。
4545
推文 2 的长度 length = 32。该推文是无效的。
4646
</pre>
4747

48-
4948
## 解法
5049

5150
<!-- 这里可写通用的实现逻辑 -->
5251

52+
- `CHAR_LENGTH(str)`: 中文、数字、字母都是 1 字节
53+
- `LENGTH(str)`:
54+
- utf8: 中文 3 字节,数字、字母 1 字节
55+
- gbk: 中文 2 字节,数字、字母 1 字节
56+
5357
<!-- tabs:start -->
5458

5559
### **SQL**
5660

5761
```sql
58-
62+
# Write your MySQL query statement below
63+
SELECT
64+
tweet_id
65+
FROM
66+
Tweets
67+
WHERE
68+
CHAR_LENGTH(content) > 15;
5969
```
6070

61-
<!-- tabs:end -->
71+
<!-- tabs:end -->

solution/1600-1699/1683.Invalid Tweets/README_EN.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ Tweet 2 has length = 32. It is an invalid tweet.
5454
### **SQL**
5555

5656
```sql
57-
57+
# Write your MySQL query statement below
58+
SELECT
59+
tweet_id
60+
FROM
61+
Tweets
62+
WHERE
63+
CHAR_LENGTH(content) > 15;
5864
```
5965

6066
<!-- tabs:end -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Write your MySQL query statement below
2+
SELECT
3+
tweet_id
4+
FROM
5+
Tweets
6+
WHERE
7+
CHAR_LENGTH(content) > 15;

solution/1700-1799/1757.Recyclable and Low Fat Products/README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,14 @@ Result 表:
5959
### **SQL**
6060

6161
```sql
62-
62+
# Write your MySQL query statement below
63+
SELECT
64+
product_id
65+
FROM
66+
Products
67+
WHERE
68+
low_fats = 'Y'
69+
AND recyclable = 'Y';
6370
```
6471

6572
<!-- tabs:end -->

solution/1700-1799/1757.Recyclable and Low Fat Products/README_EN.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ Only products 1 and 3 are both low fat and recyclable.
5757
### **SQL**
5858

5959
```sql
60-
60+
# Write your MySQL query statement below
61+
SELECT
62+
product_id
63+
FROM
64+
Products
65+
WHERE
66+
low_fats = 'Y'
67+
AND recyclable = 'Y';
6168
```
6269

6370
<!-- tabs:end -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Write your MySQL query statement below
2+
SELECT
3+
product_id
4+
FROM
5+
Products
6+
WHERE
7+
low_fats = 'Y'
8+
AND recyclable = 'Y';

solution/1800-1899/1821.Find Customers With Positive Revenue this Year/README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,14 @@ Result table:
7070
<!-- 这里可写当前语言的特殊实现逻辑 -->
7171

7272
```sql
73-
73+
# Write your MySQL query statement below
74+
SELECT
75+
customer_id
76+
FROM
77+
Customers
78+
WHERE
79+
year = '2021'
80+
AND revenue > 0;
7481
```
7582

7683
<!-- tabs:end -->

solution/1800-1899/1821.Find Customers With Positive Revenue this Year/README_EN.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,14 @@ Thus only customers 1 and 4 have postive revenue in year 2021.</pre>
6565
### **SQL**
6666

6767
```sql
68-
68+
# Write your MySQL query statement below
69+
SELECT
70+
customer_id
71+
FROM
72+
Customers
73+
WHERE
74+
year = '2021'
75+
AND revenue > 0;
6976
```
7077

7178
<!-- tabs:end -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Write your MySQL query statement below
2+
SELECT
3+
customer_id
4+
FROM
5+
Customers
6+
WHERE
7+
year = '2021'
8+
AND revenue > 0;

0 commit comments

Comments
 (0)