/**
 * Given two dictionaries, find the common values between them.
 *
 * @param dict1 First dictionary.
 * @param dict2 Second dictionary.
 * @return A list containing the common values found in the dictionaries.
 * @throws IllegalArgumentException If a dictionary is empty.
 *
 * Example:
 * val dict1 = mapOf("a" to 1, "b" to 2, "c" to 3)
 * val dict2 = mapOf("b" to 4, "c" to 3, "d" to 5)
 * findCommonValues(dict1, dict2)
 * Output: [3]
 */
fun findCommonValues(dict1: Map<String, Int>, dict2: Map<String, Int>): List<Int> {

    if (dict1.isEmpty() || dict2.isEmpty()) {
        throw IllegalArgumentException("The dictionaries cannot be empty.")
    }

    val commonValues = mutableListOf<Int>()

    for ((_, value) in dict1) {
        if (value in dict2.values) {
            commonValues.add(value)
        }
    }

    for ((_, value) in dict2) {
        if (value in dict1.values) {
            commonValues.add(value)
        }
    }

    return commonValues
}
/**
 * Given two dictionaries, find the common values between them.
 *
 * @param dict1 First dictionary.
 * @param dict2 Second dictionary.
 * @return A list containing the common values found in the dictionaries.
 * @throws IllegalArgumentException If a dictionary is empty.
 *
 * Example:
 * val dict1 = mapOf("a" to 1, "b" to 2, "c" to 3)
 * val dict2 = mapOf("b" to 4, "c" to 3, "d" to 5)
 * findCommonValues(dict1, dict2)
 * Output: [3]
 */
fun findCommonValues(dict1: Map<String, Int>, dict2: Map<String, Int>): List<Int> {
/**
 * Given two dictionaries, find the common values between them.
 *
 * @param dict1 First dictionary.
 * @param dict2 Second dictionary.
 * @return A list containing the common values found in the dictionaries.
 * @throws IllegalArgumentException If a dictionary is empty.
 *
 * Example:
 * val dict1 = mapOf("a" to 1, "b" to 2, "c" to 3)
 * val dict2 = mapOf("b" to 4, "c" to 3, "d" to 5)
 * findCommonValues(dict1, dict2)
 * Output: [3]
 */
fun findCommonValues(dict1: Map<String, Int>, dict2: Map<String, Int>): List<Int> {

    if (dict1.isEmpty() || dict2.isEmpty()) {
        throw IllegalArgumentException("The dictionaries cannot be empty.")
    }

    val commonValues = mutableListOf<Int>()

    for ((_, value) in dict1) {
        if (value in dict2.values) {
            commonValues.add(value)
        }
    }

    for ((_, value) in dict2) {
        if (value in dict1.values) {
            commonValues.add(value)
        }
    }

    return commonValues
}