/**
 * This exercise aims to test your understanding of both dictionary methods and list comprehension.
 * Your task is to write a function that takes a list of dictionaries as input and returns a list of common keys among all dictionaries.
 *
 * @param dictionaryList A list of dictionaries.
 * @return A list of common keys across all dictionaries.
 */
fun commonKeys(dictionaryList: List<Map<String, Any>>): List<String> {

    // Initialize a set with the keys of the first dictionary
    var commonKeysSet = dictionaryList[0].keys
    
    // Iterate through the remaining dictionaries in the list starting from the second dictionary
    for (i in 1 until dictionaryList.size) {
        // Update the commonKeysSet with the intersection of keys between the current set and keys of the current dictionary
        commonKeysSet = commonKeysSet.intersect(dictionaryList[i].keys)
    }
    
    // Convert the set into a sorted list and return it
    return commonKeysSet.sorted()
}
/**
 * This exercise aims to test your understanding of both dictionary methods and list comprehension.
 * Your task is to write a function that takes a list of dictionaries as input and returns a list of common keys among all dictionaries.
 *
 * @param dictionaryList A list of dictionaries.
 * @return A list of common keys across all dictionaries.
 */
fun commonKeys(dictionaryList: List<Map<String, Any>>): List<String> {
/**
 * This exercise aims to test your understanding of both dictionary methods and list comprehension.
 * Your task is to write a function that takes a list of dictionaries as input and returns a list of common keys among all dictionaries.
 *
 * @param dictionaryList A list of dictionaries.
 * @return A list of common keys across all dictionaries.
 */
fun commonKeys(dictionaryList: List<Map<String, Any>>): List<String> {

    // Initialize a set with the keys of the first dictionary
    var commonKeysSet = dictionaryList[0].keys
    
    // Iterate through the remaining dictionaries in the list starting from the second dictionary
    for (i in 1 until dictionaryList.size) {
        // Update the commonKeysSet with the intersection of keys between the current set and keys of the current dictionary
        commonKeysSet = commonKeysSet.intersect(dictionaryList[i].keys)
    }
    
    // Convert the set into a sorted list and return it
    return commonKeysSet.sorted()
}