1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-06 07:51:41 +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": 1060,
"title": "Combine Two Tables",
"titleSlug": "combine-two-tables",
"content": "<p>Table: <code>Person</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| personId | int |\n| lastName | varchar |\n| firstName | varchar |\n+-------------+---------+\npersonId is the primary key column for this table.\nThis table contains information about the ID of some persons and their first and last names.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Table: <code>Address</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| addressId | int |\n| personId | int |\n| city | varchar |\n| state | varchar |\n+-------------+---------+\naddressId is the primary key column for this table.\nEach row of this table contains information about the city and state of one person with ID = PersonId.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Write an SQL query to report the first name, last name, city, and state of each person in the <code>Person</code> table. If the address of a <code>personId</code> is not present in the <code>Address</code> table, report <code>null</code> instead.</p>\n\n<p>Return the result table in <strong>any 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> \nPerson table:\n+----------+----------+-----------+\n| personId | lastName | firstName |\n+----------+----------+-----------+\n| 1 | Wang | Allen |\n| 2 | Alice | Bob |\n+----------+----------+-----------+\nAddress table:\n+-----------+----------+---------------+------------+\n| addressId | personId | city | state |\n+-----------+----------+---------------+------------+\n| 1 | 2 | New York City | New York |\n| 2 | 3 | Leetcode | California |\n+-----------+----------+---------------+------------+\n<strong>Output:</strong> \n+-----------+----------+---------------+----------+\n| firstName | lastName | city | state |\n+-----------+----------+---------------+----------+\n| Allen | Wang | Null | Null |\n| Bob | Alice | New York City | New York |\n+-----------+----------+---------------+----------+\n<strong>Explanation:</strong> \nThere is no address in the address table for the personId = 1 so we return null in their city and state.\naddressId = 1 contains information about the address of personId = 2.\n</pre>\n",
"content": "<p>Table: <code>Person</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| personId | int |\n| lastName | varchar |\n| firstName | varchar |\n+-------------+---------+\npersonId is the primary key (column with unique values) for this table.\nThis table contains information about the ID of some persons and their first and last names.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Table: <code>Address</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| addressId | int |\n| personId | int |\n| city | varchar |\n| state | varchar |\n+-------------+---------+\naddressId is the primary key (column with unique values) for this table.\nEach row of this table contains information about the city and state of one person with ID = PersonId.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Write a solution to report the first name, last name, city, and state of each person in the <code>Person</code> table. If the address of a <code>personId</code> is not present in the <code>Address</code> table, report <code>null</code> instead.</p>\n\n<p>Return the result table in <strong>any 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> \nPerson table:\n+----------+----------+-----------+\n| personId | lastName | firstName |\n+----------+----------+-----------+\n| 1 | Wang | Allen |\n| 2 | Alice | Bob |\n+----------+----------+-----------+\nAddress table:\n+-----------+----------+---------------+------------+\n| addressId | personId | city | state |\n+-----------+----------+---------------+------------+\n| 1 | 2 | New York City | New York |\n| 2 | 3 | Leetcode | California |\n+-----------+----------+---------------+------------+\n<strong>Output:</strong> \n+-----------+----------+---------------+----------+\n| firstName | lastName | city | state |\n+-----------+----------+---------------+----------+\n| Allen | Wang | Null | Null |\n| Bob | Alice | New York City | New York |\n+-----------+----------+---------------+----------+\n<strong>Explanation:</strong> \nThere is no address in the address table for the personId = 1 so we return null in their city and state.\naddressId = 1 contains information about the address of personId = 2.\n</pre>\n",
"translatedTitle": "组合两个表",
"translatedContent": "<p>表: <code>Person</code></p>\n\n<pre>\n+-------------+---------+\n| 列名 | 类型 |\n+-------------+---------+\n| PersonId | int |\n| FirstName | varchar |\n| LastName | varchar |\n+-------------+---------+\npersonId是该表的主键。\n该表包含一些人的ID和他们的姓和名的信息。\n</pre>\n\n<p>&nbsp;</p>\n\n<p>表: <code>Address</code></p>\n\n<pre>\n+-------------+---------+\n| 列名 | 类型 |\n+-------------+---------+\n| AddressId | int |\n| PersonId | int |\n| City | varchar |\n| State | varchar |\n+-------------+---------+\naddressId是该表的主键。\n该表的每一行都包含一个ID = PersonId的人的城市和州的信息。\n</pre>\n\n<p>&nbsp;</p>\n\n<p>编写一个SQL查询来报告 <code>Person</code> 表中每个人的姓、名、城市和状态。如果 <code>personId</code> 的地址不在&nbsp;<code>Address</code>&nbsp;表中,则报告为&nbsp;<code>null</code>&nbsp;。</p>\n\n<p>以 <strong>任意顺序</strong> 返回结果表。</p>\n\n<p>查询结果格式如下所示。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong> \nPerson表:\n+----------+----------+-----------+\n| personId | lastName | firstName |\n+----------+----------+-----------+\n| 1 | Wang | Allen |\n| 2 | Alice | Bob |\n+----------+----------+-----------+\nAddress表:\n+-----------+----------+---------------+------------+\n| addressId | personId | city | state |\n+-----------+----------+---------------+------------+\n| 1 | 2 | New York City | New York |\n| 2 | 3 | Leetcode | California |\n+-----------+----------+---------------+------------+\n<strong>输出:</strong> \n+-----------+----------+---------------+----------+\n| firstName | lastName | city | state |\n+-----------+----------+---------------+----------+\n| Allen | Wang | Null | Null |\n| Bob | Alice | New York City | New York |\n+-----------+----------+---------------+----------+\n<strong>解释:</strong> \n地址表中没有 personId = 1 的地址所以它们的城市和州返回null。\naddressId = 1 包含了 personId = 2 的地址信息。</pre>\n",
"translatedContent": "<p>表: <code>Person</code></p>\n\n<pre>\n+-------------+---------+\n| 列名 | 类型 |\n+-------------+---------+\n| PersonId | int |\n| FirstName | varchar |\n| LastName | varchar |\n+-------------+---------+\npersonId 是该表的主键(具有唯一值的列)。\n该表包含一些人的 ID 和他们的姓和名的信息。\n</pre>\n\n<p>&nbsp;</p>\n\n<p>表: <code>Address</code></p>\n\n<pre>\n+-------------+---------+\n| 列名 | 类型 |\n+-------------+---------+\n| AddressId | int |\n| PersonId | int |\n| City | varchar |\n| State | varchar |\n+-------------+---------+\naddressId 是该表的主键(具有唯一值的列)。\n该表的每一行都包含一个 ID = PersonId 的人的城市和州的信息。\n</pre>\n\n<p>&nbsp;</p>\n\n<p>编写解决方案,报告 <code>Person</code> 表中每个人的姓、名、城市和。如果 <code>personId</code> 的地址不在&nbsp;<code>Address</code>&nbsp;表中,则报告为&nbsp;<code>null</code>&nbsp;。</p>\n\n<p>以 <strong>任意顺序</strong> 返回结果表。</p>\n\n<p>结果格式如下所示。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong> \nPerson表:\n+----------+----------+-----------+\n| personId | lastName | firstName |\n+----------+----------+-----------+\n| 1 | Wang | Allen |\n| 2 | Alice | Bob |\n+----------+----------+-----------+\nAddress表:\n+-----------+----------+---------------+------------+\n| addressId | personId | city | state |\n+-----------+----------+---------------+------------+\n| 1 | 2 | New York City | New York |\n| 2 | 3 | Leetcode | California |\n+-----------+----------+---------------+------------+\n<strong>输出:</strong> \n+-----------+----------+---------------+----------+\n| firstName | lastName | city | state |\n+-----------+----------+---------------+----------+\n| Allen | Wang | Null | Null |\n| Bob | Alice | New York City | New York |\n+-----------+----------+---------------+----------+\n<strong>解释:</strong> \n地址表中没有 personId = 1 的地址,所以它们的城市和州返回 null。\naddressId = 1 包含了 personId = 2 的地址信息。</pre>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 1102,
"likes": 1441,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Employee Bonus\", \"titleSlug\": \"employee-bonus\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u5458\\u5de5\\u5956\\u91d1\"}]",
"similarQuestions": "[{\"title\": \"Employee Bonus\", \"titleSlug\": \"employee-bonus\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u5458\\u5de5\\u5956\\u91d1\", \"isPaidOnly\": false}]",
"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,9 +45,21 @@
"langSlug": "oraclesql",
"code": "/* Write your PL/SQL query statement below */",
"__typename": "CodeSnippetNode"
},
{
"lang": "Pandas",
"langSlug": "pythondata",
"code": "import pandas as pd\n\ndef combine_two_tables(person: pd.DataFrame, address: pd.DataFrame) -> pd.DataFrame:\n ",
"__typename": "CodeSnippetNode"
},
{
"lang": "PostgreSQL",
"langSlug": "postgresql",
"code": "-- Write your PostgreSQL query statement below",
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"373.9K\", \"totalSubmission\": \"508.6K\", \"totalAcceptedRaw\": 373851, \"totalSubmissionRaw\": 508550, \"acRate\": \"73.5%\"}",
"stats": "{\"totalAccepted\": \"538.3K\", \"totalSubmission\": \"725.3K\", \"totalAcceptedRaw\": 538276, \"totalSubmissionRaw\": 725293, \"acRate\": \"74.2%\"}",
"hints": [],
"solution": {
"id": "101",
@@ -55,8 +67,8 @@
"__typename": "ArticleNode"
},
"status": null,
"sampleTestCase": "{\"headers\":{\"Person\":[\"PersonId\",\"LastName\",\"FirstName\"],\"Address\":[\"AddressId\",\"PersonId\",\"City\",\"State\"]},\"rows\":{\"Person\":[[1,\"Wang\",\"Allen\"],[2,\"Alice\",\"Bob\"]],\"Address\":[[1,2,\"New York City\",\"New York\"],[2,3,\"Leetcode\",\"California\"]]}}",
"metaData": "{\n \"mysql\": [\n \"Create table If Not Exists Person (personId int, firstName varchar(255), lastName varchar(255))\",\n \"Create table If Not Exists Address (addressId int, personId int, city varchar(255), state varchar(255))\"\n ],\n \"mssql\": [\n \"Create table Person (personId int, firstName varchar(255), lastName varchar(255))\",\n \"Create table Address (addressId int, personId int, city varchar(255), state varchar(255))\"\n ],\n \"oraclesql\": [\n \"Create table Person (personId int, firstName varchar(255), lastName varchar(255))\",\n \"Create table Address (addressId int, personId int, city varchar(255), state varchar(255))\"\n ],\n \"database\": true\n}",
"sampleTestCase": "{\"headers\":{\"Person\":[\"personId\",\"lastName\",\"firstName\"],\"Address\":[\"addressId\",\"personId\",\"city\",\"state\"]},\"rows\":{\"Person\":[[1,\"Wang\",\"Allen\"],[2,\"Alice\",\"Bob\"]],\"Address\":[[1,2,\"New York City\",\"New York\"],[2,3,\"Leetcode\",\"California\"]]}}",
"metaData": "{\"mysql\":[\"Create table If Not Exists Person (personId int, firstName varchar(255), lastName varchar(255))\",\"Create table If Not Exists Address (addressId int, personId int, city varchar(255), state varchar(255))\"],\"mssql\":[\"Create table Person (personId int, firstName varchar(255), lastName varchar(255))\",\"Create table Address (addressId int, personId int, city varchar(255), state varchar(255))\"],\"oraclesql\":[\"Create table Person (personId int, firstName varchar(255), lastName varchar(255))\",\"Create table Address (addressId int, personId int, city varchar(255), state varchar(255))\"],\"database\":true,\"name\":\"combine_two_tables\",\"pythondata\":[\"Person = pd.DataFrame([], columns=['personId', 'firstName', 'lastName']).astype({'personId':'Int64', 'firstName':'object', 'lastName':'object'})\",\"Address = pd.DataFrame([], columns=['addressId', 'personId', 'city', 'state']).astype({'addressId':'Int64', 'personId':'Int64', 'city':'object', 'state':'object'})\"],\"manual\":true,\"database_schema\":{\"Person\":{\"personId\":\"INT\",\"firstName\":\"VARCHAR(255)\",\"lastName\":\"VARCHAR(255)\"},\"Address\":{\"addressId\":\"INT\",\"personId\":\"INT\",\"city\":\"VARCHAR(255)\",\"state\":\"VARCHAR(255)\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
@@ -70,7 +82,7 @@
"insert into Address (addressId, personId, city, state) values ('2', '3', 'Leetcode', 'California')"
],
"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,