/**
 * This function takes in two lists of movies in which two actors have starred.
 * It finds the common movies in which these two actors have worked together.
 * The function returns a list of common movies.
 *
 * Note: The function can handle lists of movies with negative values, representing the quality of the movie.
 *
 * Example:
 * actor1 = ["Movie A", "Movie B", "Movie C", "Movie D", "Movie E"]
 * actor2 = ["Movie C", "Movie D", "Movie E", "Movie F"]
 * findCommonMovies(actor1, actor2)
 * Returns: ['Movie C', 'Movie D', 'Movie E']
 */
fun findCommonMovies(actor1: List<String>, actor2: List<String>): List<String> {

    // Convert the lists to sets for efficient intersection operation
    val actor1Movies = actor1.toSet()
    val actor2Movies = actor2.toSet()

    // Find the common movies between the two actors using set intersection
    val commonMovies = actor1Movies.intersect(actor2Movies).toList()

    // Return the list of common movies
    return commonMovies
}
/**
 * This function takes in two lists of movies in which two actors have starred.
 * It finds the common movies in which these two actors have worked together.
 * The function returns a list of common movies.
 *
 * Note: The function can handle lists of movies with negative values, representing the quality of the movie.
 *
 * Example:
 * actor1 = ["Movie A", "Movie B", "Movie C", "Movie D", "Movie E"]
 * actor2 = ["Movie C", "Movie D", "Movie E", "Movie F"]
 * findCommonMovies(actor1, actor2)
 * Returns: ['Movie C', 'Movie D', 'Movie E']
 */
fun findCommonMovies(actor1: List<String>, actor2: List<String>): List<String> {
/**
 * This function takes in two lists of movies in which two actors have starred.
 * It finds the common movies in which these two actors have worked together.
 * The function returns a list of common movies.
 *
 * Note: The function can handle lists of movies with negative values, representing the quality of the movie.
 *
 * Example:
 * actor1 = ["Movie A", "Movie B", "Movie C", "Movie D", "Movie E"]
 * actor2 = ["Movie C", "Movie D", "Movie E", "Movie F"]
 * findCommonMovies(actor1, actor2)
 * Returns: ['Movie C', 'Movie D', 'Movie E']
 */
fun findCommonMovies(actor1: List<String>, actor2: List<String>): List<String> {

    // Convert the lists to sets for efficient intersection operation
    val actor1Movies = actor1.toSet()
    val actor2Movies = actor2.toSet()

    // Find the common movies between the two actors using set intersection
    val commonMovies = actor1Movies.intersect(actor2Movies).toList()

    // Return the list of common movies
    return commonMovies
}