/**
 * This function takes a list of houses and a firefighter object as arguments.
 * The firefighter has the ability to extinguish fires in houses.
 * The objective of this exercise is to remove houses that are currently burning from the list.
 * If the firefighter is not available to extinguish the fire, the burning house should not be removed.
 *
 * @param houses A list of houses, where each house is represented as a string.
 * @param firefighter Whether the firefighter is available or not.
 * @return Updated list of houses with burning houses removed.
 */
fun removeBurningHouses(houses: MutableList<String>, firefighter: Boolean): List<String> {

    val iterator = houses.iterator()
    while (iterator.hasNext()) {
        val house = iterator.next()
        if (firefighter && house == "Burning") {
            // If firefighter is available and the house is burning, remove the house
            iterator.remove()
        } else if (!firefighter && house == "Burning") {
            // If firefighter is not available and the house is burning, skip removing the house
            continue
        }
    }
    return houses
}
/**
 * This function takes a list of houses and a firefighter object as arguments.
 * The firefighter has the ability to extinguish fires in houses.
 * The objective of this exercise is to remove houses that are currently burning from the list.
 * If the firefighter is not available to extinguish the fire, the burning house should not be removed.
 *
 * @param houses A list of houses, where each house is represented as a string.
 * @param firefighter Whether the firefighter is available or not.
 * @return Updated list of houses with burning houses removed.
 */
fun removeBurningHouses(houses: MutableList<String>, firefighter: Boolean): List<String> {
/**
 * This function takes a list of houses and a firefighter object as arguments.
 * The firefighter has the ability to extinguish fires in houses.
 * The objective of this exercise is to remove houses that are currently burning from the list.
 * If the firefighter is not available to extinguish the fire, the burning house should not be removed.
 *
 * @param houses A list of houses, where each house is represented as a string.
 * @param firefighter Whether the firefighter is available or not.
 * @return Updated list of houses with burning houses removed.
 */
fun removeBurningHouses(houses: MutableList<String>, firefighter: Boolean): List<String> {

    val iterator = houses.iterator()
    while (iterator.hasNext()) {
        val house = iterator.next()
        if (firefighter && house == "Burning") {
            // If firefighter is available and the house is burning, remove the house
            iterator.remove()
        } else if (!firefighter && house == "Burning") {
            // If firefighter is not available and the house is burning, skip removing the house
            continue
        }
    }
    return houses
}