๐ฌ Finding Frequent Actor-Director Collaborations
In the entertainment industry, successful partnerships between actors and directors often lead to multiple collaborations. Your task is to analyze a database of movie collaborations and identify the most frequent partnerships.
You are given a table ActorDirector that records every collaboration between actors and directors:
| Column Name | Type | Description |
|---|---|---|
actor_id | int | Unique identifier for the actor |
director_id | int | Unique identifier for the director |
timestamp | int | When the movie was made (primary key) |
Goal: Find all pairs (actor_id, director_id) where the actor has worked with the director on at least 3 movies.
Example: If actor 1 worked with director 1 on movies recorded at timestamps 0, 1, and 2, then this pair should be included in the result because they collaborated 3 times.
Return the result in any order. The focus is on identifying these power partnerships in the film industry!
Input & Output
Visualization
Time & Space Complexity
Single pass through the data to group and count
Space for k distinct actor-director pairs in the hash table
Constraints
- 1 โค Number of rows โค 1000
- 1 โค actor_id, director_id โค 500
- 0 โค timestamp โค 108
- timestamp is the primary key (each movie is unique)