/**
 * Given a list of animals and their corresponding weights, find and return the names of animals that have a weight
 * greater than or equal to a given threshold.
 *
 * @param animals A list of animal names.
 * @param weights A map mapping animal names to their weights.
 * @param threshold The minimum weight threshold for selection.
 * @return A list of animal names with weights greater than or equal to the threshold.
 */
fun findMaxWeight(animals: List<String>, weights: Map<String, Float>, threshold: Float): List<String> {

    val selectedAnimals = mutableListOf<String>()
    
    // Iterate over each animal in the list
    for (animal in animals) {
        // Check if the weight of the current animal is greater than or equal to the threshold
        if (weights.getOrDefault(animal, 0f) >= threshold) {
            selectedAnimals.add(animal)
        }
    }
    
    return selectedAnimals
}
/**
 * Given a list of animals and their corresponding weights, find and return the names of animals that have a weight
 * greater than or equal to a given threshold.
 *
 * @param animals A list of animal names.
 * @param weights A map mapping animal names to their weights.
 * @param threshold The minimum weight threshold for selection.
 * @return A list of animal names with weights greater than or equal to the threshold.
 */
fun findMaxWeight(animals: List<String>, weights: Map<String, Float>, threshold: Float): List<String> {
/**
 * Given a list of animals and their corresponding weights, find and return the names of animals that have a weight
 * greater than or equal to a given threshold.
 *
 * @param animals A list of animal names.
 * @param weights A map mapping animal names to their weights.
 * @param threshold The minimum weight threshold for selection.
 * @return A list of animal names with weights greater than or equal to the threshold.
 */
fun findMaxWeight(animals: List<String>, weights: Map<String, Float>, threshold: Float): List<String> {

    val selectedAnimals = mutableListOf<String>()
    
    // Iterate over each animal in the list
    for (animal in animals) {
        // Check if the weight of the current animal is greater than or equal to the threshold
        if (weights.getOrDefault(animal, 0f) >= threshold) {
            selectedAnimals.add(animal)
        }
    }
    
    return selectedAnimals
}