Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 6d90c23

Browse files
rising-temperature
1 parent e8444d5 commit 6d90c23

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

‎MySQL/rising-temperature.sql‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Time: O(n^2)
22
# Space: O(n)
33

4-
SELECT wt1.Id
5-
FROM Weather wt1, Weather wt2
6-
WHERE wt1.Temperature > wt2.Temperature AND
7-
TO_DAYS(wt1.DATE)-TO_DAYS(wt2.DATE)=1;
4+
SELECT t.id FROM Weather t
5+
JOIN Weather m ON t.recordDate = DATE_ADD(m.recordDate, interval 1 day)
6+
WHERE t.temperature > m.temperature
87

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /