1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-02-10 01:10:26 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/合作过至少三次的演员和导演 [actors-and-directors-who-cooperated-at-least-three-times].html

44 lines
1.3 KiB
HTML
Raw Normal View History

2022-03-27 20:37:52 +08:00
<p><code>ActorDirector</code>&nbsp;表:</p>
<pre>
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| actor_id | int |
| director_id | int |
| timestamp | int |
+-------------+---------+
2023-12-09 18:42:21 +08:00
timestamp 是这张表的主键(具有唯一值的列).
2022-03-27 20:37:52 +08:00
</pre>
<p>&nbsp;</p>
2023-12-09 18:42:21 +08:00
<p>编写解决方案找出合作过至少三次的演员和导演的 id 对&nbsp;<code>(actor_id, director_id)</code></p>
2022-03-27 20:37:52 +08:00
2023-12-09 18:42:21 +08:00
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
2022-03-27 20:37:52 +08:00
<pre>
2023-12-09 18:42:21 +08:00
<strong>输入:</strong>
2022-03-27 20:37:52 +08:00
ActorDirector 表:
+-------------+-------------+-------------+
| actor_id | director_id | timestamp |
+-------------+-------------+-------------+
| 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
<strong>输出:</strong>
2022-03-27 20:37:52 +08:00
+-------------+-------------+
| actor_id | director_id |
+-------------+-------------+
| 1 | 1 |
+-------------+-------------+
2023-12-09 18:42:21 +08:00
<strong>解释:</strong>
2022-03-27 20:37:52 +08:00
唯一的 id 对是 (1, 1),他们恰好合作了 3 次。</pre>