1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode/originData/managers-with-at-least-5-direct-reports.json
2023-12-09 19:57:46 +08:00

102 lines
7.6 KiB
JSON

{
"data": {
"question": {
"questionId": "570",
"questionFrontendId": "570",
"boundTopicId": null,
"title": "Managers with at Least 5 Direct Reports",
"titleSlug": "managers-with-at-least-5-direct-reports",
"content": "<p>Table: <code>Employee</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| id | int |\n| name | varchar |\n| department | varchar |\n| managerId | int |\n+-------------+---------+\nid is the primary key (column with unique values) for this table.\nEach row of this table indicates the name of an employee, their department, and the id of their manager.\nIf managerId is null, then the employee does not have a manager.\nNo employee will be the manager of themself.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Write a solution to find managers with at least <strong>five direct reports</strong>.</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> \nEmployee table:\n+-----+-------+------------+-----------+\n| id | name | department | managerId |\n+-----+-------+------------+-----------+\n| 101 | John | A | null |\n| 102 | Dan | A | 101 |\n| 103 | James | A | 101 |\n| 104 | Amy | A | 101 |\n| 105 | Anne | A | 101 |\n| 106 | Ron | B | 101 |\n+-----+-------+------------+-----------+\n<strong>Output:</strong> \n+------+\n| name |\n+------+\n| John |\n+------+\n</pre>\n",
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 845,
"dislikes": 88,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\": {\"Employee\": [\"id\", \"name\", \"department\", \"managerId\"]}, \"rows\": {\"Employee\": [[101, \"John\", \"A\", null],[102, \"Dan\", \"A\", 101], [103, \"James\", \"A\", 101], [104, \"Amy\", \"A\", 101], [105, \"Anne\", \"A\", 101], [106, \"Ron\", \"B\", 101]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [
{
"name": "Database",
"slug": "database",
"translatedName": null,
"__typename": "TopicTagNode"
}
],
"companyTagStats": null,
"codeSnippets": [
{
"lang": "MySQL",
"langSlug": "mysql",
"code": "# Write your MySQL query statement below\n",
"__typename": "CodeSnippetNode"
},
{
"lang": "MS SQL Server",
"langSlug": "mssql",
"code": "/* Write your T-SQL query statement below */\n",
"__typename": "CodeSnippetNode"
},
{
"lang": "Oracle",
"langSlug": "oraclesql",
"code": "/* Write your PL/SQL query statement below */\n",
"__typename": "CodeSnippetNode"
},
{
"lang": "Pandas",
"langSlug": "pythondata",
"code": "import pandas as pd\n\ndef find_managers(employee: pd.DataFrame) -> pd.DataFrame:\n ",
"__typename": "CodeSnippetNode"
},
{
"lang": "PostgreSQL",
"langSlug": "postgresql",
"code": "-- Write your PostgreSQL query statement below\n",
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"200.9K\", \"totalSubmission\": \"375.5K\", \"totalAcceptedRaw\": 200876, \"totalSubmissionRaw\": 375501, \"acRate\": \"53.5%\"}",
"hints": [
"Try to get all the mangerIDs that have count bigger than 5",
"Use the last hint's result as a table and do join with origin table at id equals to managerId",
"This is a very good example to show the performance of SQL code. Try to work out other solutions and you may be surprised by running time difference.",
"If your solution uses 'IN' function and runs more than 5 seconds, try to optimize it by using 'JOIN' instead."
],
"solution": {
"id": "209",
"canSeeDetail": false,
"paidOnly": true,
"hasVideoSolution": false,
"paidOnlyVideo": true,
"__typename": "ArticleNode"
},
"status": null,
"sampleTestCase": "{\"headers\": {\"Employee\": [\"id\", \"name\", \"department\", \"managerId\"]}, \"rows\": {\"Employee\": [[101, \"John\", \"A\", null],[102, \"Dan\", \"A\", 101], [103, \"James\", \"A\", 101], [104, \"Amy\", \"A\", 101], [105, \"Anne\", \"A\", 101], [106, \"Ron\", \"B\", 101]]}}",
"metaData": "{\"mysql\": [\"Create table If Not Exists Employee (id int, name varchar(255), department varchar(255), managerId int)\"], \"mssql\": [\"Create table Employee (id int, name varchar(255), department varchar(255), managerId int)\"], \"oraclesql\": [\"Create table Employee (id int, name varchar(255), department varchar(255), managerId int)\"], \"database\": true, \"name\": \"find_managers\", \"pythondata\": [\"Employee = pd.DataFrame([], columns=['id', 'name', 'department', 'managerId']).astype({'id':'Int64', 'name':'object', 'department':'object', 'managerId':'Int64'})\"], \"manual\": false, \"postgresql\": [\"\\nCreate table If Not Exists Employee (id int, name varchar(255), department varchar(255), managerId int)\"], \"database_schema\": {\"Employee\": {\"id\": \"INT\", \"name\": \"VARCHAR(255)\", \"department\": \"VARCHAR(255)\", \"managerId\": \"INT\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Employee (id int, name varchar(255), department varchar(255), managerId int)",
"Truncate table Employee",
"insert into Employee (id, name, department, managerId) values ('101', 'John', 'A', 'None')",
"insert into Employee (id, name, department, managerId) values ('102', 'Dan', 'A', '101')",
"insert into Employee (id, name, department, managerId) values ('103', 'James', 'A', '101')",
"insert into Employee (id, name, department, managerId) values ('104', 'Amy', 'A', '101')",
"insert into Employee (id, name, department, managerId) values ('105', 'Anne', 'A', '101')",
"insert into Employee (id, name, department, managerId) values ('106', 'Ron', 'B', '101')"
],
"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>\"], \"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,
"__typename": "QuestionNode"
}
}
}