/**
 * Given a list of equipment and a list of firefighters, determine the equipment that every firefighter has.
 *
 * @param equipmentList A list of sets representing the equipment possessed by each firefighter.
 * @param firefighterList A list of firefighters.
 * @return A set representing the equipment that every firefighter has.
 *
 * Example:
 * determineFirefighterEquipment(listOf(setOf(1, 2, 3), setOf(2, 4, 5), setOf(1, 2, 5)), listOf("John", "Alice", "Tom")) // Returns setOf(2)
 */
fun determineFirefighterEquipment(equipmentList: List<Set<Int>>, firefighterList: List<String>): Set<Int> {

    if (firefighterList.isEmpty()) {
        return emptySet()
    }

    var commonEquipment = HashSet(equipmentList[0])

    for (equipment in equipmentList.subList(1, equipmentList.size)) {
        commonEquipment.retainAll(equipment)
    }

    return commonEquipment
}
/**
 * Given a list of equipment and a list of firefighters, determine the equipment that every firefighter has.
 *
 * @param equipmentList A list of sets representing the equipment possessed by each firefighter.
 * @param firefighterList A list of firefighters.
 * @return A set representing the equipment that every firefighter has.
 *
 * Example:
 * determineFirefighterEquipment(listOf(setOf(1, 2, 3), setOf(2, 4, 5), setOf(1, 2, 5)), listOf("John", "Alice", "Tom")) // Returns setOf(2)
 */
fun determineFirefighterEquipment(equipmentList: List<Set<Int>>, firefighterList: List<String>): Set<Int> {
/**
 * Given a list of equipment and a list of firefighters, determine the equipment that every firefighter has.
 *
 * @param equipmentList A list of sets representing the equipment possessed by each firefighter.
 * @param firefighterList A list of firefighters.
 * @return A set representing the equipment that every firefighter has.
 *
 * Example:
 * determineFirefighterEquipment(listOf(setOf(1, 2, 3), setOf(2, 4, 5), setOf(1, 2, 5)), listOf("John", "Alice", "Tom")) // Returns setOf(2)
 */
fun determineFirefighterEquipment(equipmentList: List<Set<Int>>, firefighterList: List<String>): Set<Int> {

    if (firefighterList.isEmpty()) {
        return emptySet()
    }

    var commonEquipment = HashSet(equipmentList[0])

    for (equipment in equipmentList.subList(1, equipmentList.size)) {
        commonEquipment.retainAll(equipment)
    }

    return commonEquipment
}