/**
 * A police officer needs to determine if the suspects should be arrested based on certain conditions.
 *
 * @param suspects A list of tuples containing the suspect's name, age, and whether they have a criminal record (True/False).
 * @return A list of names of suspects who should be arrested, sorted alphabetically.
 *
 * Conditions:
 * - The suspect must be above 18 years old.
 * - The suspect must not have a criminal record.
 *
 * Example:
 * checkSuspects(listOf("John Doe", 20, false), ("Jane Smith", 17, true), ("Mike Johnson", 30, false))
 * // Output: ['Mike Johnson']
 *
 * checkSuspects(listOf("Robert Williams", 28, true), ("Emily Harris", 19, false))
 * // Output: ['Emily Harris', 'John Doe']
 *
 * checkSuspects(emptyList())
 * // Output: []
 */
fun checkSuspects(suspects: List<Triple<String, Int, Boolean>>): List<String> {

    val arrestedSuspects = mutableListOf<String>()

    for ((name, age, criminalRecord) in suspects) {
        if (age > 18 && !criminalRecord) {
            arrestedSuspects.add(name)
        }
    }

    return arrestedSuspects.sorted()
}
/**
 * A police officer needs to determine if the suspects should be arrested based on certain conditions.
 *
 * @param suspects A list of tuples containing the suspect's name, age, and whether they have a criminal record (True/False).
 * @return A list of names of suspects who should be arrested, sorted alphabetically.
 *
 * Conditions:
 * - The suspect must be above 18 years old.
 * - The suspect must not have a criminal record.
 *
 * Example:
 * checkSuspects(listOf("John Doe", 20, false), ("Jane Smith", 17, true), ("Mike Johnson", 30, false))
 * // Output: ['Mike Johnson']
 *
 * checkSuspects(listOf("Robert Williams", 28, true), ("Emily Harris", 19, false))
 * // Output: ['Emily Harris', 'John Doe']
 *
 * checkSuspects(emptyList())
 * // Output: []
 */
fun checkSuspects(suspects: List<Triple<String, Int, Boolean>>): List<String> {
/**
 * A police officer needs to determine if the suspects should be arrested based on certain conditions.
 *
 * @param suspects A list of tuples containing the suspect's name, age, and whether they have a criminal record (True/False).
 * @return A list of names of suspects who should be arrested, sorted alphabetically.
 *
 * Conditions:
 * - The suspect must be above 18 years old.
 * - The suspect must not have a criminal record.
 *
 * Example:
 * checkSuspects(listOf("John Doe", 20, false), ("Jane Smith", 17, true), ("Mike Johnson", 30, false))
 * // Output: ['Mike Johnson']
 *
 * checkSuspects(listOf("Robert Williams", 28, true), ("Emily Harris", 19, false))
 * // Output: ['Emily Harris', 'John Doe']
 *
 * checkSuspects(emptyList())
 * // Output: []
 */
fun checkSuspects(suspects: List<Triple<String, Int, Boolean>>): List<String> {

    val arrestedSuspects = mutableListOf<String>()

    for ((name, age, criminalRecord) in suspects) {
        if (age > 18 && !criminalRecord) {
            arrestedSuspects.add(name)
        }
    }

    return arrestedSuspects.sorted()
}