/**
 * This exercise requires finding the intersection between the list of patients and list of medications they need.
 * Find which patients need all the medications in the given list and return their names.
 */
fun nurseExercise(patients: List<Map<String, Any>>, medications: List<String>): List<String> {

    val intersection = mutableListOf<String>()
    for (patient in patients) {
        var medicationMatch = true
        for (medication in medications) {
            if (medication !in patient["medications"] as List<String>) {
                medicationMatch = false
                break
            }
        }
        if (medicationMatch) {
            intersection.add(patient["name"] as String)
        }
    }
    return intersection
}

// Example usage
/**
 * This exercise requires finding the intersection between the list of patients and list of medications they need.
 * Find which patients need all the medications in the given list and return their names.
 */
fun nurseExercise(patients: List<Map<String, Any>>, medications: List<String>): List<String> {
/**
 * This exercise requires finding the intersection between the list of patients and list of medications they need.
 * Find which patients need all the medications in the given list and return their names.
 */
fun nurseExercise(patients: List<Map<String, Any>>, medications: List<String>): List<String> {

    val intersection = mutableListOf<String>()
    for (patient in patients) {
        var medicationMatch = true
        for (medication in medications) {
            if (medication !in patient["medications"] as List<String>) {
                medicationMatch = false
                break
            }
        }
        if (medicationMatch) {
            intersection.add(patient["name"] as String)
        }
    }
    return intersection
}

// Example usage