mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
48 lines
1.3 KiB
HTML
48 lines
1.3 KiB
HTML
<p>Table: <code>Weather</code></p>
|
|
|
|
<pre>
|
|
+---------------+---------+
|
|
| Column Name | Type |
|
|
+---------------+---------+
|
|
| id | int |
|
|
| recordDate | date |
|
|
| temperature | int |
|
|
+---------------+---------+
|
|
id is the column with unique values for this table.
|
|
This table contains information about the temperature on a certain day.
|
|
</pre>
|
|
|
|
<p> </p>
|
|
|
|
<p>Write a solution to find all dates' <code>Id</code> with higher temperatures compared to its previous dates (yesterday).</p>
|
|
|
|
<p>Return the result table in <strong>any order</strong>.</p>
|
|
|
|
<p>The result format is in the following example.</p>
|
|
|
|
<p> </p>
|
|
<p><strong class="example">Example 1:</strong></p>
|
|
|
|
<pre>
|
|
<strong>Input:</strong>
|
|
Weather table:
|
|
+----+------------+-------------+
|
|
| id | recordDate | temperature |
|
|
+----+------------+-------------+
|
|
| 1 | 2015-01-01 | 10 |
|
|
| 2 | 2015-01-02 | 25 |
|
|
| 3 | 2015-01-03 | 20 |
|
|
| 4 | 2015-01-04 | 30 |
|
|
+----+------------+-------------+
|
|
<strong>Output:</strong>
|
|
+----+
|
|
| id |
|
|
+----+
|
|
| 2 |
|
|
| 4 |
|
|
+----+
|
|
<strong>Explanation:</strong>
|
|
In 2015-01-02, the temperature was higher than the previous day (10 -> 25).
|
|
In 2015-01-04, the temperature was higher than the previous day (20 -> 30).
|
|
</pre>
|