2022-03-27 20:37:52 +08:00
{
"data" : {
"question" : {
"questionId" : "1136" ,
"questionFrontendId" : "1050" ,
"categoryTitle" : "Database" ,
"boundTopicId" : 6075 ,
"title" : "Actors and Directors Who Cooperated At Least Three Times" ,
"titleSlug" : "actors-and-directors-who-cooperated-at-least-three-times" ,
2023-12-09 18:42:21 +08:00
"content" : "<p>Table: <code>ActorDirector</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| actor_id | int |\n| director_id | int |\n| timestamp | int |\n+-------------+---------+\ntimestamp is the primary key (column with unique values) for this table.\n</pre>\n\n<p> </p>\n\n<p>Write a solution to find all the pairs <code>(actor_id, director_id)</code> where the actor has cooperated with the director at least three times.</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> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nActorDirector table:\n+-------------+-------------+-------------+\n| actor_id | director_id | timestamp |\n+-------------+-------------+-------------+\n| 1 | 1 | 0 |\n| 1 | 1 | 1 |\n| 1 | 1 | 2 |\n| 1 | 2 | 3 |\n| 1 | 2 | 4 |\n| 2 | 1 | 5 |\n| 2 | 1 | 6 |\n+-------------+-------------+-------------+\n<strong>Output:</strong> \n+-------------+-------------+\n| actor_id | director_id |\n+-------------+-------------+\n| 1 | 1 |\n+-------------+-------------+\n<strong>Explanation:</strong> The only pair is (1, 1) where they cooperated exactly 3 times.\n</pre>\n" ,
2022-03-27 20:37:52 +08:00
"translatedTitle" : "合作过至少三次的演员和导演" ,
2023-12-09 18:42:21 +08:00
"translatedContent" : "<p><code>ActorDirector</code> 表:</p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| actor_id | int |\n| director_id | int |\n| timestamp | int |\n+-------------+---------+\ntimestamp 是这张表的主键(具有唯一值的列).\n</pre>\n\n<p> </p>\n\n<p>编写解决方案找出合作过至少三次的演员和导演的 id 对 <code>(actor_id, director_id)</code></p>\n\n<p> </p>\n\n<p><strong>示例 1: </strong></p>\n\n<pre>\n<strong>输入:</strong>\nActorDirector 表:\n+-------------+-------------+-------------+\n| actor_id | director_id | timestamp |\n+-------------+-------------+-------------+\n| 1 | 1 | 0 |\n| 1 | 1 | 1 |\n| 1 | 1 | 2 |\n| 1 | 2 | 3 |\n| 1 | 2 | 4 |\n| 2 | 1 | 5 |\n| 2 | 1 | 6 |\n+-------------+-------------+-------------+\n<strong>输出:</strong>\n+-------------+-------------+\n| actor_id | director_id |\n+-------------+-------------+\n| 1 | 1 |\n+-------------+-------------+\n<strong>解释:</strong>\n唯一的 id 对是 (1, 1),他们恰好合作了 3 次。</pre>\n" ,
2022-03-27 20:37:52 +08:00
"isPaidOnly" : false ,
"difficulty" : "Easy" ,
2023-12-09 18:42:21 +08:00
"likes" : 87 ,
2022-03-27 20:37:52 +08:00
"dislikes" : 0 ,
"isLiked" : null ,
"similarQuestions" : "[]" ,
"contributors" : [ ] ,
2023-12-09 18:42:21 +08:00
"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}" ,
2022-03-27 20:37:52 +08:00
"topicTags" : [
{
"name" : "Database" ,
"slug" : "database" ,
"translatedName" : "数据库" ,
"__typename" : "TopicTagNode"
}
] ,
"companyTagStats" : null ,
"codeSnippets" : [
{
"lang" : "MySQL" ,
"langSlug" : "mysql" ,
"code" : "# Write your MySQL query statement below" ,
"__typename" : "CodeSnippetNode"
} ,
{
"lang" : "MS SQL Server" ,
"langSlug" : "mssql" ,
"code" : "/* Write your T-SQL query statement below */" ,
"__typename" : "CodeSnippetNode"
} ,
{
"lang" : "Oracle" ,
"langSlug" : "oraclesql" ,
"code" : "/* Write your PL/SQL query statement below */" ,
"__typename" : "CodeSnippetNode"
2023-12-09 18:42:21 +08:00
} ,
{
"lang" : "Pandas" ,
"langSlug" : "pythondata" ,
"code" : "import pandas as pd\n\ndef actors_and_directors(actor_director: pd.DataFrame) -> pd.DataFrame:\n " ,
"__typename" : "CodeSnippetNode"
} ,
{
"lang" : "PostgreSQL" ,
"langSlug" : "postgresql" ,
"code" : "-- Write your PostgreSQL query statement below" ,
"__typename" : "CodeSnippetNode"
2022-03-27 20:37:52 +08:00
}
] ,
2023-12-09 19:57:46 +08:00
"stats" : "{\"totalAccepted\": \"62.8K\", \"totalSubmission\": \"82.4K\", \"totalAcceptedRaw\": 62754, \"totalSubmissionRaw\": 82405, \"acRate\": \"76.2%\"}" ,
2022-03-27 20:37:52 +08:00
"hints" : [ ] ,
"solution" : null ,
"status" : null ,
"sampleTestCase" : "{\"headers\":{\"ActorDirector\":[\"actor_id\",\"director_id\",\"timestamp\"]},\"rows\":{\"ActorDirector\":[[1,1,0],[1,1,1],[1,1,2],[1,2,3],[1,2,4],[2,1,5],[2,1,6]]}}" ,
2023-12-09 18:42:21 +08:00
"metaData" : "{\"mysql\":[\"Create table If Not Exists ActorDirector (actor_id int, director_id int, timestamp int)\"],\"mssql\":[\"Create table ActorDirector (actor_id int, director_id int, timestamp int)\"],\"oraclesql\":[\"Create table ActorDirector (actor_id int, director_id int, timestamp int)\"],\"database\":true,\"name\":\"actors_and_directors\",\"pythondata\":[\"ActorDirector = pd.DataFrame([], columns=['actor_id', 'director_id', 'timestamp']).astype({'actor_id':'int64', 'director_id':'int64', 'timestamp':'int64'})\"],\"manual\":false,\"postgresql\":[\"Create table If Not Exists ActorDirector (actor_id int, director_id int, timestamp int)\"],\"database_schema\":{\"ActorDirector\":{\"actor_id\":\"INT\",\"director_id\":\"INT\",\"timestamp\":\"INT\"}}}" ,
2022-03-27 20:37:52 +08:00
"judgerAvailable" : true ,
"judgeType" : "large" ,
"mysqlSchemas" : [
"Create table If Not Exists ActorDirector (actor_id int, director_id int, timestamp int)" ,
"Truncate table ActorDirector" ,
"insert into ActorDirector (actor_id, director_id, timestamp) values ('1', '1', '0')" ,
"insert into ActorDirector (actor_id, director_id, timestamp) values ('1', '1', '1')" ,
"insert into ActorDirector (actor_id, director_id, timestamp) values ('1', '1', '2')" ,
"insert into ActorDirector (actor_id, director_id, timestamp) values ('1', '2', '3')" ,
"insert into ActorDirector (actor_id, director_id, timestamp) values ('1', '2', '4')" ,
"insert into ActorDirector (actor_id, director_id, timestamp) values ('2', '1', '5')" ,
"insert into ActorDirector (actor_id, director_id, timestamp) values ('2', '1', '6')"
] ,
"enableRunCode" : true ,
2023-12-09 18:42:21 +08:00
"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>\"]}" ,
2022-03-27 20:37:52 +08:00
"book" : null ,
"isSubscribed" : false ,
"isDailyQuestion" : false ,
"dailyRecordStatus" : null ,
"editorType" : "CKEDITOR" ,
"ugcQuestionId" : null ,
"style" : "LEETCODE" ,
"exampleTestcases" : "{\"headers\":{\"ActorDirector\":[\"actor_id\",\"director_id\",\"timestamp\"]},\"rows\":{\"ActorDirector\":[[1,1,0],[1,1,1],[1,1,2],[1,2,3],[1,2,4],[2,1,5],[2,1,6]]}}" ,
"__typename" : "QuestionNode"
}
}
}