Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 11f9d06

Browse files
feat: add solutions to lc problem: No.2117 (#1870)
1 parent 9706e12 commit 11f9d06

File tree

26 files changed

+591
-38
lines changed

26 files changed

+591
-38
lines changed

‎solution/0100-0199/0175.Combine Two Tables/README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,16 @@ FROM
9696
LEFT JOIN Address USING (personId);
9797
```
9898

99-
```pandas
99+
### **Pandas**
100+
101+
```python
100102
import pandas as pd
101103

102104

103105
def combine_two_tables(person: pd.DataFrame, address: pd.DataFrame) -> pd.DataFrame:
104106
return pd.merge(left=person, right=address, how="left", on="personId")[
105107
["firstName", "lastName", "city", "state"]
106108
]
107-
108109
```
109110

110111
<!-- tabs:end -->

‎solution/0100-0199/0175.Combine Two Tables/README_EN.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ FROM
9292
LEFT JOIN Address USING (personId);
9393
```
9494

95-
```pandas
95+
### **Pandas**
96+
97+
```python
9698
import pandas as pd
9799

98100

‎solution/0100-0199/0176.Second Highest Salary/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ WITH T AS (SELECT salary, DENSE_RANK() OVER (ORDER BY salary DESC) AS rk FROM Em
113113
SELECT (SELECT DISTINCT salary FROM T WHERE rk = 2) AS SecondHighestSalary;
114114
```
115115

116+
### **Pandas**
117+
116118
```python
117119
import pandas as pd
118120

@@ -134,7 +136,6 @@ def second_highest_salary(employee: pd.DataFrame) -> pd.DataFrame:
134136
result_df = pd.DataFrame({"SecondHighestSalary": [second_highest]})
135137

136138
return result_df
137-
138139
```
139140

140141
<!-- tabs:end -->

‎solution/0100-0199/0176.Second Highest Salary/README_EN.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ WITH T AS (SELECT salary, DENSE_RANK() OVER (ORDER BY salary DESC) AS rk FROM Em
9898
SELECT (SELECT DISTINCT salary FROM T WHERE rk = 2) AS SecondHighestSalary;
9999
```
100100

101+
### **Pandas**
102+
101103
```python
102104
import pandas as pd
103105

@@ -119,7 +121,6 @@ def second_highest_salary(employee: pd.DataFrame) -> pd.DataFrame:
119121
result_df = pd.DataFrame({"SecondHighestSalary": [second_highest]})
120122

121123
return result_df
122-
123124
```
124125

125126
<!-- tabs:end -->

‎solution/0100-0199/0177.Nth Highest Salary/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ BEGIN
9494
END
9595
```
9696

97+
### **Pandas**
98+
9799
```python
98100
import pandas as pd
99101

@@ -105,7 +107,6 @@ def nth_highest_salary(employee: pd.DataFrame, N: int) -> pd.DataFrame:
105107
else:
106108
salary = sorted(unique_salaries, reverse=True)[N - 1]
107109
return pd.DataFrame([salary], columns=[f"getNthHighestSalary({N})"])
108-
109110
```
110111

111112
<!-- tabs:end -->

‎solution/0100-0199/0177.Nth Highest Salary/README_EN.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ BEGIN
8686
END
8787
```
8888

89+
### **Pandas**
90+
8991
```python
9092
import pandas as pd
9193

@@ -97,7 +99,6 @@ def nth_highest_salary(employee: pd.DataFrame, N: int) -> pd.DataFrame:
9799
else:
98100
salary = sorted(unique_salaries, reverse=True)[N - 1]
99101
return pd.DataFrame([salary], columns=[f"getNthHighestSalary({N})"])
100-
101102
```
102103

103104
<!-- tabs:end -->

‎solution/0100-0199/0178.Rank Scores/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ FROM
122122
) s;
123123
```
124124

125+
### **Pandas**
126+
125127
```python
126128
import pandas as pd
127129

@@ -134,7 +136,6 @@ def order_scores(scores: pd.DataFrame) -> pd.DataFrame:
134136
result_df = scores.drop("id", axis=1).sort_values(by="score", ascending=False)
135137

136138
return result_df
137-
138139
```
139140

140141
<!-- tabs:end -->

‎solution/0100-0199/0178.Rank Scores/README_EN.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ FROM
113113
) s;
114114
```
115115

116+
### **Pandas**
117+
116118
```python
117119
import pandas as pd
118120

@@ -125,7 +127,6 @@ def order_scores(scores: pd.DataFrame) -> pd.DataFrame:
125127
result_df = scores.drop("id", axis=1).sort_values(by="score", ascending=False)
126128

127129
return result_df
128-
129130
```
130131

131132
<!-- tabs:end -->

‎solution/0100-0199/0180.Consecutive Numbers/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ GROUP BY p
116116
HAVING COUNT(1) >= 3;
117117
```
118118

119+
### **Pandas**
120+
119121
```python
120122
import pandas as pd
121123

@@ -130,7 +132,6 @@ def consecutive_numbers(logs: pd.DataFrame) -> pd.DataFrame:
130132
.drop_duplicates()
131133
.rename(columns={"num": "ConsecutiveNums"})
132134
)
133-
134135
```
135136

136137
<!-- tabs:end -->

‎solution/0100-0199/0180.Consecutive Numbers/README_EN.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ GROUP BY p
112112
HAVING COUNT(1) >= 3;
113113
```
114114

115+
### **Pandas**
116+
115117
```python
116118
import pandas as pd
117119

@@ -126,7 +128,6 @@ def consecutive_numbers(logs: pd.DataFrame) -> pd.DataFrame:
126128
.drop_duplicates()
127129
.rename(columns={"num": "ConsecutiveNums"})
128130
)
129-
130131
```
131132

132133
<!-- tabs:end -->

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /