1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 15:31:43 +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

@@ -6,13 +6,13 @@
"boundTopicId": null,
"title": "Daily Leads and Partners",
"titleSlug": "daily-leads-and-partners",
"content": "<p>Table: <code>DailySales</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| date_id | date |\n| make_name | varchar |\n| lead_id | int |\n| partner_id | int |\n+-------------+---------+\nThis table does not have a primary key.\nThis table contains the date and the name of the product sold and the IDs of the lead and partner it was sold to.\nThe name consists of only lowercase English letters.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Write an SQL query that will, for each <code>date_id</code> and <code>make_name</code>, return the number of <strong>distinct</strong> <code>lead_id</code>&#39;s and <strong>distinct</strong> <code>partner_id</code>&#39;s.</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> \nDailySales table:\n+-----------+-----------+---------+------------+\n| date_id | make_name | lead_id | partner_id |\n+-----------+-----------+---------+------------+\n| 2020-12-8 | toyota | 0 | 1 |\n| 2020-12-8 | toyota | 1 | 0 |\n| 2020-12-8 | toyota | 1 | 2 |\n| 2020-12-7 | toyota | 0 | 2 |\n| 2020-12-7 | toyota | 0 | 1 |\n| 2020-12-8 | honda | 1 | 2 |\n| 2020-12-8 | honda | 2 | 1 |\n| 2020-12-7 | honda | 0 | 1 |\n| 2020-12-7 | honda | 1 | 2 |\n| 2020-12-7 | honda | 2 | 1 |\n+-----------+-----------+---------+------------+\n<strong>Output:</strong> \n+-----------+-----------+--------------+-----------------+\n| date_id | make_name | unique_leads | unique_partners |\n+-----------+-----------+--------------+-----------------+\n| 2020-12-8 | toyota | 2 | 3 |\n| 2020-12-7 | toyota | 1 | 2 |\n| 2020-12-8 | honda | 2 | 2 |\n| 2020-12-7 | honda | 3 | 2 |\n+-----------+-----------+--------------+-----------------+\n<strong>Explanation:</strong> \nFor 2020-12-8, toyota gets leads = [0, 1] and partners = [0, 1, 2] while honda gets leads = [1, 2] and partners = [1, 2].\nFor 2020-12-7, toyota gets leads = [0] and partners = [1, 2] while honda gets leads = [0, 1, 2] and partners = [1, 2].\n</pre>\n",
"content": "<p>Table: <code>DailySales</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| date_id | date |\n| make_name | varchar |\n| lead_id | int |\n| partner_id | int |\n+-------------+---------+\nThere is no primary key (column with unique values) for this table. It may contain duplicates.\nThis table contains the date and the name of the product sold and the IDs of the lead and partner it was sold to.\nThe name consists of only lowercase English letters.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>For each <code>date_id</code> and <code>make_name</code>, find the number of <strong>distinct</strong> <code>lead_id</code>&#39;s and <strong>distinct</strong> <code>partner_id</code>&#39;s.</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> \nDailySales table:\n+-----------+-----------+---------+------------+\n| date_id | make_name | lead_id | partner_id |\n+-----------+-----------+---------+------------+\n| 2020-12-8 | toyota | 0 | 1 |\n| 2020-12-8 | toyota | 1 | 0 |\n| 2020-12-8 | toyota | 1 | 2 |\n| 2020-12-7 | toyota | 0 | 2 |\n| 2020-12-7 | toyota | 0 | 1 |\n| 2020-12-8 | honda | 1 | 2 |\n| 2020-12-8 | honda | 2 | 1 |\n| 2020-12-7 | honda | 0 | 1 |\n| 2020-12-7 | honda | 1 | 2 |\n| 2020-12-7 | honda | 2 | 1 |\n+-----------+-----------+---------+------------+\n<strong>Output:</strong> \n+-----------+-----------+--------------+-----------------+\n| date_id | make_name | unique_leads | unique_partners |\n+-----------+-----------+--------------+-----------------+\n| 2020-12-8 | toyota | 2 | 3 |\n| 2020-12-7 | toyota | 1 | 2 |\n| 2020-12-8 | honda | 2 | 2 |\n| 2020-12-7 | honda | 3 | 2 |\n+-----------+-----------+--------------+-----------------+\n<strong>Explanation:</strong> \nFor 2020-12-8, toyota gets leads = [0, 1] and partners = [0, 1, 2] while honda gets leads = [1, 2] and partners = [1, 2].\nFor 2020-12-7, toyota gets leads = [0] and partners = [1, 2] while honda gets leads = [0, 1, 2] and partners = [1, 2].\n</pre>\n",
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 97,
"dislikes": 9,
"likes": 510,
"dislikes": 29,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"DailySales\":[\"date_id\",\"make_name\",\"lead_id\",\"partner_id\"]},\"rows\":{\"DailySales\":[[\"2020-12-8\",\"toyota\",0,1],[\"2020-12-8\",\"toyota\",1,0],[\"2020-12-8\",\"toyota\",1,2],[\"2020-12-7\",\"toyota\",0,2],[\"2020-12-7\",\"toyota\",0,1],[\"2020-12-8\",\"honda\",1,2],[\"2020-12-8\",\"honda\",2,1],[\"2020-12-7\",\"honda\",0,1],[\"2020-12-7\",\"honda\",1,2],[\"2020-12-7\",\"honda\",2,1]]}}",
@@ -45,14 +45,33 @@
"langSlug": "oraclesql",
"code": "/* Write your PL/SQL query statement below */\n",
"__typename": "CodeSnippetNode"
},
{
"lang": "Pandas",
"langSlug": "pythondata",
"code": "import pandas as pd\n\ndef daily_leads_and_partners(daily_sales: pd.DataFrame) -> pd.DataFrame:\n ",
"__typename": "CodeSnippetNode"
},
{
"lang": "PostgreSQL",
"langSlug": "postgresql",
"code": "-- Write your PostgreSQL query statement below\n",
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"17.4K\", \"totalSubmission\": \"19.1K\", \"totalAcceptedRaw\": 17450, \"totalSubmissionRaw\": 19052, \"acRate\": \"91.6%\"}",
"stats": "{\"totalAccepted\": \"104.2K\", \"totalSubmission\": \"120.3K\", \"totalAcceptedRaw\": 104210, \"totalSubmissionRaw\": 120278, \"acRate\": \"86.6%\"}",
"hints": [],
"solution": null,
"solution": {
"id": "2029",
"canSeeDetail": false,
"paidOnly": true,
"hasVideoSolution": false,
"paidOnlyVideo": true,
"__typename": "ArticleNode"
},
"status": null,
"sampleTestCase": "{\"headers\":{\"DailySales\":[\"date_id\",\"make_name\",\"lead_id\",\"partner_id\"]},\"rows\":{\"DailySales\":[[\"2020-12-8\",\"toyota\",0,1],[\"2020-12-8\",\"toyota\",1,0],[\"2020-12-8\",\"toyota\",1,2],[\"2020-12-7\",\"toyota\",0,2],[\"2020-12-7\",\"toyota\",0,1],[\"2020-12-8\",\"honda\",1,2],[\"2020-12-8\",\"honda\",2,1],[\"2020-12-7\",\"honda\",0,1],[\"2020-12-7\",\"honda\",1,2],[\"2020-12-7\",\"honda\",2,1]]}}",
"metaData": "{\n \"mysql\": [\n \"Create table If Not Exists DailySales(date_id date, make_name varchar(20), lead_id int, partner_id int)\"\n ],\n \"mssql\": [\n \"Create table DailySales(date_id date, make_name varchar(20), lead_id int, partner_id int)\"\n ],\n \"oraclesql\": [\n \"Create table DailySales(date_id date, make_name varchar(20), lead_id int, partner_id int)\",\n \"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"\n ],\n \"database\": true\n}",
"metaData": "{\"mysql\": [\"Create table If Not Exists DailySales(date_id date, make_name varchar(20), lead_id int, partner_id int)\"], \"mssql\": [\"Create table DailySales(date_id date, make_name varchar(20), lead_id int, partner_id int)\"], \"oraclesql\": [\"Create table DailySales(date_id date, make_name varchar(20), lead_id int, partner_id int)\", \"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"], \"database\": true, \"name\": \"daily_leads_and_partners\", \"pythondata\": [\"DailySales = pd.DataFrame([], columns=['date_id', 'make_name', 'lead_id', 'partner_id']).astype({'date_id':'datetime64[ns]', 'make_name':'object', 'lead_id':'Int64', 'partner_id':'Int64'})\"], \"manual\": false, \"postgresql\": [\"\\nCreate table If Not Exists DailySales(date_id date, make_name varchar(20), lead_id int, partner_id int)\"], \"database_schema\": {\"DailySales\": {\"date_id\": \"DATE\", \"make_name\": \"VARCHAR(20)\", \"lead_id\": \"INT\", \"partner_id\": \"INT\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
@@ -72,7 +91,7 @@
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"]}",
"envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"], \"pythondata\": [\"Pandas\", \"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0</p>\"], \"postgresql\": [\"PostgreSQL\", \"<p>PostgreSQL 16</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,