Skip to content

Commit f37ecf3

Browse files
fix: update solution to lc problem: No.0177 (#4803)
1 parent 1c85b98 commit f37ecf3

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ import pandas as pd
9595

9696

9797
def nth_highest_salary(employee: pd.DataFrame, N: int) -> pd.DataFrame:
98+
if N < 1:
99+
return pd.DataFrame({"getNthHighestSalary(" + str(N) + ")": [None]})
98100
unique_salaries = employee.salary.unique()
99101
if len(unique_salaries) < N:
100102
return pd.DataFrame([np.NaN], columns=[f"getNthHighestSalary({N})"])

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ import pandas as pd
9393

9494

9595
def nth_highest_salary(employee: pd.DataFrame, N: int) -> pd.DataFrame:
96+
if N < 1:
97+
return pd.DataFrame({"getNthHighestSalary(" + str(N) + ")": [None]})
9698
unique_salaries = employee.salary.unique()
9799
if len(unique_salaries) < N:
98100
return pd.DataFrame([np.NaN], columns=[f"getNthHighestSalary({N})"])

solution/0100-0199/0177.Nth Highest Salary/Solution.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33

44
def nth_highest_salary(employee: pd.DataFrame, N: int) -> pd.DataFrame:
5+
if N < 1:
6+
return pd.DataFrame({"getNthHighestSalary(" + str(N) + ")": [None]})
57
unique_salaries = employee.salary.unique()
68
if len(unique_salaries) < N:
79
return pd.DataFrame([np.NaN], columns=[f"getNthHighestSalary({N})"])

0 commit comments

Comments
 (0)