/**
 * Given a list of artists, remove any duplicate names from the list and return the modified list
 */
fun deleteDuplicates(artists: List<Map<String, Any>>): List<Map<String, Any>> {

    val uniqueNames = mutableListOf<Map<String, Any>>() // store unique artist names

    for (artist in artists) {
        // check if the artist name is already in the uniqueNames list
        if (artist["name"] !in uniqueNames.map { it["name"] }) {
            // if not present, add the artist details to the uniqueNames list
            uniqueNames.add(artist)
        }
    }

    return uniqueNames
}

// Example Usage:
val artists = listOf(
    mapOf("name" to "Vincent van Gogh", "born" to 1853, "died" to 1890),
    mapOf("name" to "Pablo Picasso", "born" to 1881, "died" to 1973),
    mapOf("name" to "Claude Monet", "born" to 1840, "died" to 1926),
    mapOf("name" to "Vincent van Gogh", "born" to 1853, "died" to 1890),
    mapOf("name" to "Leonardo da Vinci", "born" to 1452, "died" to 1519),
    mapOf("name" to "Pablo Picasso")
)
/**
 * Given a list of artists, remove any duplicate names from the list and return the modified list
 */
fun deleteDuplicates(artists: List<Map<String, Any>>): List<Map<String, Any>> {
/**
 * Given a list of artists, remove any duplicate names from the list and return the modified list
 */
fun deleteDuplicates(artists: List<Map<String, Any>>): List<Map<String, Any>> {

    val uniqueNames = mutableListOf<Map<String, Any>>() // store unique artist names

    for (artist in artists) {
        // check if the artist name is already in the uniqueNames list
        if (artist["name"] !in uniqueNames.map { it["name"] }) {
            // if not present, add the artist details to the uniqueNames list
            uniqueNames.add(artist)
        }
    }

    return uniqueNames
}

// Example Usage:
val artists = listOf(
    mapOf("name" to "Vincent van Gogh", "born" to 1853, "died" to 1890),
    mapOf("name" to "Pablo Picasso", "born" to 1881, "died" to 1973),
    mapOf("name" to "Claude Monet", "born" to 1840, "died" to 1926),
    mapOf("name" to "Vincent van Gogh", "born" to 1853, "died" to 1890),
    mapOf("name" to "Leonardo da Vinci", "born" to 1452, "died" to 1519),
    mapOf("name" to "Pablo Picasso")
)