/**
 * Given a list of nurses and their schedules, find the nurses who are available on all days.
 *
 * @param nurses a set of nurses
 * @param schedules a nested list containing the schedules of each nurse
 * @return a set of nurses who are available on all days
 */
fun nurseSchedule(nurses: Set<Int>, schedules: List<List<Int>>): Set<Int> {

    val availableNurses = nurses.toMutableSet()

    for (day in schedules[0].indices) {
        val iterator = availableNurses.iterator()
        while (iterator.hasNext()) {
            val nurse = iterator.next()
            if (day < schedules[nurse].size && schedules[nurse][day] == 0) {
                iterator.remove()
                continue
            }
        }
    }

    return availableNurses
}
/**
 * Given a list of nurses and their schedules, find the nurses who are available on all days.
 *
 * @param nurses a set of nurses
 * @param schedules a nested list containing the schedules of each nurse
 * @return a set of nurses who are available on all days
 */
fun nurseSchedule(nurses: Set<Int>, schedules: List<List<Int>>): Set<Int> {
/**
 * Given a list of nurses and their schedules, find the nurses who are available on all days.
 *
 * @param nurses a set of nurses
 * @param schedules a nested list containing the schedules of each nurse
 * @return a set of nurses who are available on all days
 */
fun nurseSchedule(nurses: Set<Int>, schedules: List<List<Int>>): Set<Int> {

    val availableNurses = nurses.toMutableSet()

    for (day in schedules[0].indices) {
        val iterator = availableNurses.iterator()
        while (iterator.hasNext()) {
            val nurse = iterator.next()
            if (day < schedules[nurse].size && schedules[nurse][day] == 0) {
                iterator.remove()
                continue
            }
        }
    }

    return availableNurses
}