Simplest MS SQL SERVER solution using dense_rank()
CREATE FUNCTION getNthHighestSalary(@N INT) RETURNS INT AS\nBEGIN\n    RETURN (\n        / Write your T-SQL query statement below. /\n\t\t//we are using top 1 b
CREATE FUNCTION getNthHighestSalary(@N INT) RETURNS INT AS\nBEGIN\n    RETURN (\n        /* Write your T-SQL query statement below. */\n\t\t//we are using top 1 beacuse in case of multiple records with same salary we just want to return single salary\n        select top 1 salary AS getNthHighestSalary from \n        (select id,salary,DENSE_RANK() over (order by salary desc)AS ranking from  Employee)temp\n        where temp.ranking= @N\n      );\nEND
[]