/**
 * A firefighter needs to find the common locations they have been assigned to.
 * Given two lists 'locations1' and 'locations2' containing the assigned locations,
 * complete the function to return a list of the common locations.
 *
 * @param locations1 List of assigned locations of the firefighter.
 * @param locations2 List of assigned locations of the firefighter.
 * @return List of common locations between the two lists.
 *
 * Example:
 * getCommonLocations(listOf("Fire Station", "Hospital", "School"), listOf("Hospital", "Park", "Fire Station"))
 * Output: ["Fire Station", "Hospital"]
 */
fun getCommonLocations(locations1: List<String>, locations2: List<String>): List<String> {

    // Using filter and intersect to find common locations
    val commonLocations = locations1.filter { it in locations2 }
    return commonLocations
}
/**
 * A firefighter needs to find the common locations they have been assigned to.
 * Given two lists 'locations1' and 'locations2' containing the assigned locations,
 * complete the function to return a list of the common locations.
 *
 * @param locations1 List of assigned locations of the firefighter.
 * @param locations2 List of assigned locations of the firefighter.
 * @return List of common locations between the two lists.
 *
 * Example:
 * getCommonLocations(listOf("Fire Station", "Hospital", "School"), listOf("Hospital", "Park", "Fire Station"))
 * Output: ["Fire Station", "Hospital"]
 */
fun getCommonLocations(locations1: List<String>, locations2: List<String>): List<String> {
/**
 * A firefighter needs to find the common locations they have been assigned to.
 * Given two lists 'locations1' and 'locations2' containing the assigned locations,
 * complete the function to return a list of the common locations.
 *
 * @param locations1 List of assigned locations of the firefighter.
 * @param locations2 List of assigned locations of the firefighter.
 * @return List of common locations between the two lists.
 *
 * Example:
 * getCommonLocations(listOf("Fire Station", "Hospital", "School"), listOf("Hospital", "Park", "Fire Station"))
 * Output: ["Fire Station", "Hospital"]
 */
fun getCommonLocations(locations1: List<String>, locations2: List<String>): List<String> {

    // Using filter and intersect to find common locations
    val commonLocations = locations1.filter { it in locations2 }
    return commonLocations
}