Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5e93250

Browse files
committedNov 8, 2020
add solution for leetcode 177 184 197
1 parent 706e57c commit 5e93250

File tree

4 files changed

+47
-0
lines changed

4 files changed

+47
-0
lines changed
 

‎README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,17 +233,20 @@
233233
|200|[Number of Islands](https://leetcode.com/problems/number-of-islands/)| |Medium|
234234
|199|[Binary Tree Right Side View](https://leetcode.com/problems/binary-tree-right-side-view/)| |Medium|
235235
|198|[House Robber](https://leetcode.com/problems/house-robber/)| |Easy|
236+
|197|[Rising Temperature](https://leetcode.com/problems/rising-temperature/)| [Mysql](./algorithms/risingTemperature/Solution.sql) |Easy|
236237
|196|[Delete Duplicate Emails](https://leetcode.com/problems/delete-duplicate-emails/)| [Mysql](./algorithms/deleteDuplicateEmails/Solution.sql) |Easy|
237238
|191|[Number of 1 Bits](https://leetcode.com/problems/number-of-1-bits/)| [java](./algorithms/numberof1bits/Solution.java) |Easy|
238239
|190|[Reverse Bits](https://leetcode.com/problems/reverse-bits/)| |Easy|
239240
|189|[Rotate Array](https://leetcode.com/problems/rotate-array/)| |Easy|
240241
|188|[Best Time to Buy and Sell Stock IV](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/)| |Hard|
241242
|187|[Repeated DNA Sequences](https://leetcode.com/problems/repeated-dna-sequences/)| |Medium|
242243
|186|[Reverse Words in a String II](https://leetcode.com/problems/reverse-words-in-a-string-ii/) ♥ | |Medium|
244+
|184|[Department Highest Salary/](https://leetcode.com/problems/department-highest-salary/)| [Mysql](./algorithms/departmentHightestSalary/Solution.sql) |Medium|
243245
|183|[Customers Who Never Order](https://leetcode.com/problems/customers-who-never-order/)| [Mysql](./algorithms/customersWhoNeverOrder/Solution.sql) |Easy|
244246
|182|[Duplicate Email](https://leetcode.com/problems/duplicate-emails/)| [Mysql](./algorithms/duplicateEmails/Solution.sql) |Easy|
245247
|181|[Employees Earning More Than Their Managers](https://leetcode.com/problems/employees-earning-more-than-their-managers/)| [Mysql](./algorithms/employeesEarningMoreThanTheirManagers/Solution.sql) |Easy|
246248
|179|[Largest Number](https://leetcode.com/problems/largest-number/) | |Medium|
249+
|177|[Nth Highest Salary](https://leetcode.com/problems/nth-highest-salary/)| [Mysql](./algorithms/nthHightestSalary/Solution.sql) |Easy|
247250
|176|[Second Highest Salary](https://leetcode.com/problems/second-highest-salary/)| [Mysql](./algorithms/secondHightestSalary/Solution.sql) |Easy|
248251
|175|[Combine Two Tables](https://leetcode.com/problems/combine-two-tables/)| [Mysql](./algorithms/combineTwoTable/Solution.sql) |Easy|
249252
|174|[Dungeon Game](https://leetcode.com/problems/dungeon-game/) | |Hard|
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-- # Write your MySQL query statement below
2+
-- Group BY 函数进行分组
3+
SELECT
4+
Department.name AS 'Department',
5+
Employee.name AS 'Employee',
6+
Salary
7+
FROM
8+
Employee
9+
JOIN
10+
Department ON Employee.DepartmentId = Department.Id
11+
WHERE
12+
(Employee.DepartmentId , Salary) IN
13+
( SELECT
14+
DepartmentId, MAX(Salary)
15+
FROM
16+
Employee
17+
GROUP BY DepartmentId
18+
)
19+
;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
2+
BEGIN
3+
SET N := N-1;
4+
RETURN (
5+
# Write your MySQL query statement below.
6+
SELECT
7+
salary
8+
FROM
9+
employee
10+
GROUP BY
11+
salary
12+
ORDER BY
13+
salary DESC
14+
LIMIT N, 1
15+
);
16+
END
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Write your MySQL query statement below
2+
SELECT
3+
weather.id AS 'Id'
4+
FROM
5+
weather weather
6+
JOIN
7+
weather w ON DATEDIFF(weather.recordDate, w.recordDate) = 1
8+
AND weather.Temperature > w.Temperature
9+
;

0 commit comments

Comments
 (0)
Please sign in to comment.