1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-08 00:41:42 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

存量题库数据更新

This commit is contained in:
2023-12-09 18:42:21 +08:00
parent a788808cd7
commit c198538f10
10843 changed files with 288489 additions and 248355 deletions

View File

@@ -7,17 +7,17 @@
"boundTopicId": 1421,
"title": "Human Traffic of Stadium",
"titleSlug": "human-traffic-of-stadium",
"content": "<p>Table: <code>Stadium</code></p>\n\n<pre>\n+---------------+---------+\n| Column Name | Type |\n+---------------+---------+\n| id | int |\n| visit_date | date |\n| people | int |\n+---------------+---------+\nvisit_date is the primary key for this table.\nEach row of this table contains the visit date and visit id to the stadium with the number of people during the visit.\nNo two rows will have the same visit_date, and as the id increases, the dates increase as well.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Write an SQL query to display the records with three or more rows with <strong>consecutive</strong> <code>id</code>&#39;s, and the number of people is greater than or equal to 100 for each.</p>\n\n<p>Return the result table ordered by <code>visit_date</code> in <strong>ascending order</strong>.</p>\n\n<p>The query result format is in the following example.</p>\n\n<p>&nbsp;</p>\n<p><strong>Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nStadium table:\n+------+------------+-----------+\n| id | visit_date | people |\n+------+------------+-----------+\n| 1 | 2017-01-01 | 10 |\n| 2 | 2017-01-02 | 109 |\n| 3 | 2017-01-03 | 150 |\n| 4 | 2017-01-04 | 99 |\n| 5 | 2017-01-05 | 145 |\n| 6 | 2017-01-06 | 1455 |\n| 7 | 2017-01-07 | 199 |\n| 8 | 2017-01-09 | 188 |\n+------+------------+-----------+\n<strong>Output:</strong> \n+------+------------+-----------+\n| id | visit_date | people |\n+------+------------+-----------+\n| 5 | 2017-01-05 | 145 |\n| 6 | 2017-01-06 | 1455 |\n| 7 | 2017-01-07 | 199 |\n| 8 | 2017-01-09 | 188 |\n+------+------------+-----------+\n<strong>Explanation:</strong> \nThe four rows with ids 5, 6, 7, and 8 have consecutive ids and each of them has &gt;= 100 people attended. Note that row 8 was included even though the visit_date was not the next day after row 7.\nThe rows with ids 2 and 3 are not included because we need at least three consecutive ids.\n</pre>\n",
"content": "<p>Table: <code>Stadium</code></p>\n\n<pre>\n+---------------+---------+\n| Column Name | Type |\n+---------------+---------+\n| id | int |\n| visit_date | date |\n| people | int |\n+---------------+---------+\nvisit_date is the column with unique values for this table.\nEach row of this table contains the visit date and visit id to the stadium with the number of people during the visit.\nAs the id increases, the date increases as well.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Write a solution to display the records with three or more rows with <strong>consecutive</strong> <code>id</code>&#39;s, and the number of people is greater than or equal to 100 for each.</p>\n\n<p>Return the result table ordered by <code>visit_date</code> in <strong>ascending order</strong>.</p>\n\n<p>The result format is in the following example.</p>\n\n<p>&nbsp;</p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nStadium table:\n+------+------------+-----------+\n| id | visit_date | people |\n+------+------------+-----------+\n| 1 | 2017-01-01 | 10 |\n| 2 | 2017-01-02 | 109 |\n| 3 | 2017-01-03 | 150 |\n| 4 | 2017-01-04 | 99 |\n| 5 | 2017-01-05 | 145 |\n| 6 | 2017-01-06 | 1455 |\n| 7 | 2017-01-07 | 199 |\n| 8 | 2017-01-09 | 188 |\n+------+------------+-----------+\n<strong>Output:</strong> \n+------+------------+-----------+\n| id | visit_date | people |\n+------+------------+-----------+\n| 5 | 2017-01-05 | 145 |\n| 6 | 2017-01-06 | 1455 |\n| 7 | 2017-01-07 | 199 |\n| 8 | 2017-01-09 | 188 |\n+------+------------+-----------+\n<strong>Explanation:</strong> \nThe four rows with ids 5, 6, 7, and 8 have consecutive ids and each of them has &gt;= 100 people attended. Note that row 8 was included even though the visit_date was not the next day after row 7.\nThe rows with ids 2 and 3 are not included because we need at least three consecutive ids.\n</pre>\n",
"translatedTitle": "体育馆的人流量",
"translatedContent": "表:<code>Stadium</code>\n<pre>\n+---------------+---------+\n| Column Name | Type |\n+---------------+---------+\n| id | int |\n| visit_date | date |\n| people | int |\n+---------------+---------+\nvisit_date 是表的主键\n每日人流量信息被记录在这三列信息中<strong>序号</strong> (id)、<strong>日期</strong> (visit_date)、&nbsp;<strong>人流量</strong> (people)\n每天只有一行记录日期随着 id 的增加而增加\n</pre>\n\n<p>&nbsp;</p>\n\n<p>编写一个 SQL 查询以找出每行的人数大于或等于 <code>100</code> 且 <code>id</code> 连续的三行或更多行记录。</p>\n\n<p>返回按 <code>visit_date</code> <strong>升序排列</strong> 的结果表。</p>\n\n<p>查询结果格式如下所示。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<code><strong>输入:</strong>\nStadium</code> 表:\n+------+------------+-----------+\n| id | visit_date | people |\n+------+------------+-----------+\n| 1 | 2017-01-01 | 10 |\n| 2 | 2017-01-02 | 109 |\n| 3 | 2017-01-03 | 150 |\n| 4 | 2017-01-04 | 99 |\n| 5 | 2017-01-05 | 145 |\n| 6 | 2017-01-06 | 1455 |\n| 7 | 2017-01-07 | 199 |\n| 8 | 2017-01-09 | 188 |\n+------+------------+-----------+\n<strong>输出:</strong>\n+------+------------+-----------+\n| id | visit_date | people |\n+------+------------+-----------+\n| 5 | 2017-01-05 | 145 |\n| 6 | 2017-01-06 | 1455 |\n| 7 | 2017-01-07 | 199 |\n| 8 | 2017-01-09 | 188 |\n+------+------------+-----------+\n<strong>解释:\nid</strong> 为 5、6、7、8 的四行 id 连续,并且每行都有 &gt;= 100 的人数记录。\n请注意即使第 7 行和第 8 行的 visit_date 不是连续的,输出也应当包含第 8 行,因为我们只需要考虑 id 连续的记录。\n不输出 id 为 2 和 3 的行,因为至少需要三条 id 连续的记录。</pre>\n",
"translatedContent": "表:<code>Stadium</code>\n<pre>\n+---------------+---------+\n| Column Name | Type |\n+---------------+---------+\n| id | int |\n| visit_date | date |\n| people | int |\n+---------------+---------+\nvisit_date 是该表中具有唯一值的列。\n每日人流量信息被记录在这三列信息中<strong>序号</strong> (id)、<strong>日期</strong> (visit_date)、&nbsp;<strong>人流量</strong> (people)\n每天只有一行记录日期随着 id 的增加而增加\n</pre>\n\n<p>&nbsp;</p>\n\n<p>编写解决方案找出每行的人数大于或等于 <code>100</code> 且 <code>id</code> 连续的三行或更多行记录。</p>\n\n<p>返回按 <code>visit_date</code> <strong>升序排列</strong> 的结果表。</p>\n\n<p>查询结果格式如下所示。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<code><strong>输入:</strong>\nStadium</code> 表:\n+------+------------+-----------+\n| id | visit_date | people |\n+------+------------+-----------+\n| 1 | 2017-01-01 | 10 |\n| 2 | 2017-01-02 | 109 |\n| 3 | 2017-01-03 | 150 |\n| 4 | 2017-01-04 | 99 |\n| 5 | 2017-01-05 | 145 |\n| 6 | 2017-01-06 | 1455 |\n| 7 | 2017-01-07 | 199 |\n| 8 | 2017-01-09 | 188 |\n+------+------------+-----------+\n<strong>输出:</strong>\n+------+------------+-----------+\n| id | visit_date | people |\n+------+------------+-----------+\n| 5 | 2017-01-05 | 145 |\n| 6 | 2017-01-06 | 1455 |\n| 7 | 2017-01-07 | 199 |\n| 8 | 2017-01-09 | 188 |\n+------+------------+-----------+\n<strong>解释:\nid</strong> 为 5、6、7、8 的四行 id 连续,并且每行都有 &gt;= 100 的人数记录。\n请注意即使第 7 行和第 8 行的 visit_date 不是连续的,输出也应当包含第 8 行,因为我们只需要考虑 id 连续的记录。\n不输出 id 为 2 和 3 的行,因为至少需要三条 id 连续的记录。</pre>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 247,
"likes": 338,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"contributors": [],
"langToValidPlayground": "{\"cpp\": false, \"java\": false, \"python\": false, \"python3\": false, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"ruby\": false, \"bash\": false, \"swift\": false, \"golang\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"kotlin\": false, \"rust\": false, \"php\": false, \"typescript\": false, \"racket\": false, \"erlang\": false, \"elixir\": false}",
"langToValidPlayground": "{\"cpp\": false, \"java\": false, \"python\": false, \"python3\": false, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"typescript\": false, \"bash\": false, \"php\": false, \"swift\": false, \"kotlin\": false, \"dart\": false, \"golang\": false, \"ruby\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"rust\": false, \"racket\": false, \"erlang\": false, \"elixir\": false, \"pythondata\": false, \"react\": false, \"vanillajs\": false, \"postgresql\": false}",
"topicTags": [
{
"name": "Database",
@@ -45,14 +45,26 @@
"langSlug": "oraclesql",
"code": "/* Write your PL/SQL query statement below */",
"__typename": "CodeSnippetNode"
},
{
"lang": "Pandas",
"langSlug": "pythondata",
"code": "import pandas as pd\n\ndef human_traffic(stadium: pd.DataFrame) -> pd.DataFrame:\n ",
"__typename": "CodeSnippetNode"
},
{
"lang": "PostgreSQL",
"langSlug": "postgresql",
"code": "-- Write your PostgreSQL query statement below",
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"38.5K\", \"totalSubmission\": \"77K\", \"totalAcceptedRaw\": 38483, \"totalSubmissionRaw\": 77022, \"acRate\": \"50.0%\"}",
"stats": "{\"totalAccepted\": \"54.2K\", \"totalSubmission\": \"113K\", \"totalAcceptedRaw\": 54224, \"totalSubmissionRaw\": 112996, \"acRate\": \"48.0%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\": {\"stadium\": [\"id\", \"visit_date\", \"people\"]}, \"rows\": {\"stadium\": [[1, \"2017-01-01\", 10], [2, \"2017-01-02\", 109], [3, \"2017-01-03\", 150], [4, \"2017-01-04\", 99], [5, \"2017-01-05\", 145], [6, \"2017-01-06\", 1455], [7, \"2017-01-07\", 199], [8, \"2017-01-09\", 188]]}}",
"metaData": "{\n \"mysql\": [\n \"Create table If Not Exists Stadium (id int, visit_date DATE NULL, people int)\"\n ],\n \"mssql\": [\n \"Create table Stadium (id int, visit_date DATE NULL, people int)\"\n ],\n \"oraclesql\": [\n \"Create table Stadium (id int, visit_date DATE, people int)\",\n \"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"\n ],\n \"database\": true\n}",
"sampleTestCase": "{\"headers\": {\"Stadium\": [\"id\", \"visit_date\", \"people\"]}, \"rows\": {\"Stadium\": [[1, \"2017-01-01\", 10], [2, \"2017-01-02\", 109], [3, \"2017-01-03\", 150], [4, \"2017-01-04\", 99], [5, \"2017-01-05\", 145], [6, \"2017-01-06\", 1455], [7, \"2017-01-07\", 199], [8, \"2017-01-09\", 188]]}}",
"metaData": "{\"mysql\":[\"Create table If Not Exists Stadium (id int, visit_date DATE NULL, people int)\"],\"mssql\":[\"Create table Stadium (id int, visit_date DATE NULL, people int)\"],\"oraclesql\":[\"Create table Stadium (id int, visit_date DATE, people int)\",\"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"],\"database\":true,\"name\":\"human_traffic\",\"pythondata\":[\"Stadium = pd.DataFrame([], columns=['id', 'visit_date', 'people']).astype({'id':'Int64', 'visit_date':'datetime64[ns]', 'people':'Int64'})\\n\"],\"postgresql\":[\"\\nCreate table If Not Exists Stadium (id int, visit_date DATE NULL, people int)\"],\"database_schema\":{\"Stadium\":{\"id\":\"INT\",\"visit_date\":\"DATE\",\"people\":\"INT\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
@@ -68,7 +80,7 @@
"insert into Stadium (id, visit_date, people) values ('8', '2017-01-09', '188')"
],
"enableRunCode": true,
"envInfo": "{\"mysql\":[\"MySQL\",\"<p>\\u7248\\u672c\\uff1a<code>MySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"<p>mssql server 2019.<\\/p>\"],\"oraclesql\":[\"Oracle\",\"<p>Oracle Sql 11.2.<\\/p>\"]}",
"envInfo": "{\"mysql\":[\"MySQL\",\"<p>\\u7248\\u672c\\uff1a<code>MySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"<p>mssql server 2019.<\\/p>\"],\"oraclesql\":[\"Oracle\",\"<p>Oracle Sql 11.2.<\\/p>\"],\"pythondata\":[\"Pandas\",\"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0<\\/p>\"],\"postgresql\":[\"PostgreSQL\",\"<p>PostgreSQL 16<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,