/**
 * Geologists need to find the unique elements present in different rock samples.
 * You are given a dictionary where the keys represent the sample names and the values represent the list
 * of elements found in that sample. Your task is to create a set containing all the unique elements
 * found across all the samples.
 *
 * Example:
 * rock_samples = mapOf(
 *     "sample1" to listOf("quartz", "feldspar", "mica"),
 *     "sample2" to listOf("quartz", "magnetite"),
 *     "sample3" to listOf("feldspar", "mica", "calcite")
 * )
 *
 * findUniqueElements(rock_samples) -> setOf("quartz", "feldspar", "mica", "magnetite", "calcite")
 */
fun findUniqueElements(rockSamples: Map<String, List<String>>): Set<String> {

    val uniqueElements = mutableSetOf<String>()  // Create an empty set to hold unique elements

    // Iterate over each rock sample
    for (sampleElements in rockSamples.values) {
        for (element in sampleElements) {
            // Add each element to the set
            uniqueElements.add(element)
        }
    }

    return uniqueElements
}
/**
 * Geologists need to find the unique elements present in different rock samples.
 * You are given a dictionary where the keys represent the sample names and the values represent the list
 * of elements found in that sample. Your task is to create a set containing all the unique elements
 * found across all the samples.
 *
 * Example:
 * rock_samples = mapOf(
 *     "sample1" to listOf("quartz", "feldspar", "mica"),
 *     "sample2" to listOf("quartz", "magnetite"),
 *     "sample3" to listOf("feldspar", "mica", "calcite")
 * )
 *
 * findUniqueElements(rock_samples) -> setOf("quartz", "feldspar", "mica", "magnetite", "calcite")
 */
fun findUniqueElements(rockSamples: Map<String, List<String>>): Set<String> {
/**
 * Geologists need to find the unique elements present in different rock samples.
 * You are given a dictionary where the keys represent the sample names and the values represent the list
 * of elements found in that sample. Your task is to create a set containing all the unique elements
 * found across all the samples.
 *
 * Example:
 * rock_samples = mapOf(
 *     "sample1" to listOf("quartz", "feldspar", "mica"),
 *     "sample2" to listOf("quartz", "magnetite"),
 *     "sample3" to listOf("feldspar", "mica", "calcite")
 * )
 *
 * findUniqueElements(rock_samples) -> setOf("quartz", "feldspar", "mica", "magnetite", "calcite")
 */
fun findUniqueElements(rockSamples: Map<String, List<String>>): Set<String> {

    val uniqueElements = mutableSetOf<String>()  // Create an empty set to hold unique elements

    // Iterate over each rock sample
    for (sampleElements in rockSamples.values) {
        for (element in sampleElements) {
            // Add each element to the set
            uniqueElements.add(element)
        }
    }

    return uniqueElements
}