/**
 * Given a list of numbers representing the positions of animals on a number line and a list of animal names,
 * return a new list indicating whether each animal is present at its respective position (true) or not (false).
 *
 * @param numbers A list of integers representing the positions of animals on a number line.
 * @param animals A list of strings representing the names of animals.
 * @return A list of booleans indicating whether each animal is present at its respective position or not.
 *
 * Example:
 * checkAnimalPresence(listOf(1, 3, 5, 7), listOf("tiger", "lion", "elephant", "giraffe"))
 * Output: [true, true, false, true]
 */
fun checkAnimalPresence(numbers: List<Int>, animals: List<String>): List<Boolean> {

    val animalPresence = mutableListOf<Boolean>()
    var numberIndex = 0
    for (animalIndex in animals.indices) {
        if (numbers[numberIndex] == animalIndex) {
            animalPresence.add(true)
            numberIndex++
        } else {
            animalPresence.add(false)
        }
    }
    return animalPresence
}
/**
 * Given a list of numbers representing the positions of animals on a number line and a list of animal names,
 * return a new list indicating whether each animal is present at its respective position (true) or not (false).
 *
 * @param numbers A list of integers representing the positions of animals on a number line.
 * @param animals A list of strings representing the names of animals.
 * @return A list of booleans indicating whether each animal is present at its respective position or not.
 *
 * Example:
 * checkAnimalPresence(listOf(1, 3, 5, 7), listOf("tiger", "lion", "elephant", "giraffe"))
 * Output: [true, true, false, true]
 */
fun checkAnimalPresence(numbers: List<Int>, animals: List<String>): List<Boolean> {
/**
 * Given a list of numbers representing the positions of animals on a number line and a list of animal names,
 * return a new list indicating whether each animal is present at its respective position (true) or not (false).
 *
 * @param numbers A list of integers representing the positions of animals on a number line.
 * @param animals A list of strings representing the names of animals.
 * @return A list of booleans indicating whether each animal is present at its respective position or not.
 *
 * Example:
 * checkAnimalPresence(listOf(1, 3, 5, 7), listOf("tiger", "lion", "elephant", "giraffe"))
 * Output: [true, true, false, true]
 */
fun checkAnimalPresence(numbers: List<Int>, animals: List<String>): List<Boolean> {

    val animalPresence = mutableListOf<Boolean>()
    var numberIndex = 0
    for (animalIndex in animals.indices) {
        if (numbers[numberIndex] == animalIndex) {
            animalPresence.add(true)
            numberIndex++
        } else {
            animalPresence.add(false)
        }
    }
    return animalPresence
}