FunctionRacerProblemsRace

Nth Highest Salary

EasypandasPython

staff has columns name and salary. Return the n-th highest different salary as an int (n = 1 is the highest). If there are fewer than n different salaries, return -1.

Example 1

staff {"name":["a","b","c","d"],"salary":[50,70,70,20]}
n 2
returns 50

Different salaries: 70, 50, 20. The 2nd is 50.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More pandas problems