/**
 * A police officer needs to check if a person is allowed to park their car at a certain time.
 * The officer has a set of ticket numbers issued to different individuals, and a specific time.
 * The officer will allow a person to park their car only if the last digit of their license plate is even.
 * Additionally, the parking is also allowed if the person has a valid ticket number and their age is higher than 18.
 * The function 'checkTicket' should take in a license plate number, an age, the current time, and a list of ticket numbers,
 * and return a boolean value indicating if the person can park their car.
 */
fun checkTicket(licensePlate: String, age: Int, time: Int, ticketNumbers: List<Int>): Boolean {

    // Extract the last digit of the license plate number
    val lastDigit = licensePlate.last().toString().toInt()

    // Check if the last digit is even
    if (lastDigit % 2 != 0) {
        return false
    }

    // Check if the person has a valid ticket number
    if (ticketNumbers.isNotEmpty()) {
        for (ticket in ticketNumbers) {
            // Check if the current ticket number matches the license plate
            if (ticket == lastDigit) {
                return age > 18
            }
        }
    }

    return false
}
/**
 * A police officer needs to check if a person is allowed to park their car at a certain time.
 * The officer has a set of ticket numbers issued to different individuals, and a specific time.
 * The officer will allow a person to park their car only if the last digit of their license plate is even.
 * Additionally, the parking is also allowed if the person has a valid ticket number and their age is higher than 18.
 * The function 'checkTicket' should take in a license plate number, an age, the current time, and a list of ticket numbers,
 * and return a boolean value indicating if the person can park their car.
 */
fun checkTicket(licensePlate: String, age: Int, time: Int, ticketNumbers: List<Int>): Boolean {
/**
 * A police officer needs to check if a person is allowed to park their car at a certain time.
 * The officer has a set of ticket numbers issued to different individuals, and a specific time.
 * The officer will allow a person to park their car only if the last digit of their license plate is even.
 * Additionally, the parking is also allowed if the person has a valid ticket number and their age is higher than 18.
 * The function 'checkTicket' should take in a license plate number, an age, the current time, and a list of ticket numbers,
 * and return a boolean value indicating if the person can park their car.
 */
fun checkTicket(licensePlate: String, age: Int, time: Int, ticketNumbers: List<Int>): Boolean {

    // Extract the last digit of the license plate number
    val lastDigit = licensePlate.last().toString().toInt()

    // Check if the last digit is even
    if (lastDigit % 2 != 0) {
        return false
    }

    // Check if the person has a valid ticket number
    if (ticketNumbers.isNotEmpty()) {
        for (ticket in ticketNumbers) {
            // Check if the current ticket number matches the license plate
            if (ticket == lastDigit) {
                return age > 18
            }
        }
    }

    return false
}