Problem 177

Nth Highest Salary

Posted by Ruizhi Ma on August 22, 2019

问题描述

https://leetcode.com/problems/nth-highest-salary/

代码

CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
DECLARE m INT;
SET m = n - 1;

  RETURN (
      # Write your MySQL query statement below.
      SELECT Salary
      FROM Employee
      GROUP BY Salary
      ORDER BY Salary DESC
      LIMIT m, 1
  );
END

复杂度分析

  1. 时间复杂度:
  2. 空间复杂度:

0 comments
Anonymous
Error: Bad credentials.
Markdown is supported

Be the first person to leave a comment!