My solution extend to N


  • 0
    W
    SELECT max(Salary)   
    FROM Employee E1
    WHERE (N-1) =
    SELECT COUNT(DISTINCT(E2.Salary))
    FROM Employee E2  
    WHERE E2.Salary > E1.Salary)
    

    //max() used to filter the null situation


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.