mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
76 lines
4.9 KiB
JSON
76 lines
4.9 KiB
JSON
{
|
|
"data": {
|
|
"question": {
|
|
"questionId": "1877",
|
|
"questionFrontendId": "1729",
|
|
"boundTopicId": null,
|
|
"title": "Find Followers Count",
|
|
"titleSlug": "find-followers-count",
|
|
"content": "<p>Table: <code>Followers</code></p>\n\n<pre>\n+-------------+------+\n| Column Name | Type |\n+-------------+------+\n| user_id | int |\n| follower_id | int |\n+-------------+------+\n(user_id, follower_id) is the primary key for this table.\nThis table contains the IDs of a user and a follower in a social media app where the follower follows the user.</pre>\n\n<p> </p>\n\n<p>Write an SQL query that will, for each user, return the number of followers.</p>\n\n<p>Return the result table ordered by <code>user_id</code>.</p>\n\n<p>The query result format is in the following example.</p>\n\n<p> </p>\n<p><strong>Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nFollowers table:\n+---------+-------------+\n| user_id | follower_id |\n+---------+-------------+\n| 0 | 1 |\n| 1 | 0 |\n| 2 | 0 |\n| 2 | 1 |\n+---------+-------------+\n<strong>Output:</strong> \n+---------+----------------+\n| user_id | followers_count|\n+---------+----------------+\n| 0 | 1 |\n| 1 | 1 |\n| 2 | 2 |\n+---------+----------------+\n<strong>Explanation:</strong> \nThe followers of 0 are {1}\nThe followers of 1 are {0}\nThe followers of 2 are {0,1}\n</pre>\n",
|
|
"translatedTitle": null,
|
|
"translatedContent": null,
|
|
"isPaidOnly": false,
|
|
"difficulty": "Easy",
|
|
"likes": 60,
|
|
"dislikes": 9,
|
|
"isLiked": null,
|
|
"similarQuestions": "[]",
|
|
"exampleTestcases": "{\"headers\":{\"Followers\":[\"user_id\",\"follower_id\"]},\"rows\":{\"Followers\":[[\"0\",\"1\"],[\"1\",\"0\"],[\"2\",\"0\"],[\"2\",\"1\"]]}}",
|
|
"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"
|
|
}
|
|
],
|
|
"stats": "{\"totalAccepted\": \"12.8K\", \"totalSubmission\": \"17.9K\", \"totalAcceptedRaw\": 12793, \"totalSubmissionRaw\": 17917, \"acRate\": \"71.4%\"}",
|
|
"hints": [],
|
|
"solution": null,
|
|
"status": null,
|
|
"sampleTestCase": "{\"headers\":{\"Followers\":[\"user_id\",\"follower_id\"]},\"rows\":{\"Followers\":[[\"0\",\"1\"],[\"1\",\"0\"],[\"2\",\"0\"],[\"2\",\"1\"]]}}",
|
|
"metaData": "{\n \"mysql\": [\n \"Create table If Not Exists Followers(user_id int, follower_id int)\"\n ],\n \"mssql\": [\n \"Create table Followers(user_id int, follower_id int)\"\n ],\n \"oraclesql\": [\n \"Create table Followers(user_id int, follower_id int)\"\n ],\n \"database\": true\n}",
|
|
"judgerAvailable": true,
|
|
"judgeType": "large",
|
|
"mysqlSchemas": [
|
|
"Create table If Not Exists Followers(user_id int, follower_id int)",
|
|
"Truncate table Followers",
|
|
"insert into Followers (user_id, follower_id) values ('0', '1')",
|
|
"insert into Followers (user_id, follower_id) values ('1', '0')",
|
|
"insert into Followers (user_id, follower_id) values ('2', '0')",
|
|
"insert into Followers (user_id, follower_id) values ('2', '1')"
|
|
],
|
|
"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>\"]}",
|
|
"libraryUrl": null,
|
|
"adminUrl": null,
|
|
"challengeQuestion": null,
|
|
"__typename": "QuestionNode"
|
|
}
|
|
}
|
|
} |