/**
 * This exercise aims to test your understanding of set intersection and slicing in Kotlin.
 * Given two sets, set1 and set2, your task is to write a function that returns the intersection of the two sets.
 * To solve this exercise, follow these steps:
 *
 * 1. Find the common elements between set1 and set2.
 * 2. Utilize slicing to sort the resulting intersection in descending order.
 * 3. Return the sorted intersection as the output of the function.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The sorted intersection of set1 and set2.
 */
fun intersectionOfSets(set1: Set<Int>, set2: Set<Int>): List<Int> {

    val intersection = set1.intersect(set2)  // Find the common elements between set1 and set2
    val sortedIntersection = intersection.sortedDescending()  // Sort the intersection in descending order
    return sortedIntersection
}

// Example usage:
val set1 = setOf(6, 8, 2, 10, 4)
val set2 = setOf(1, 8, 12, 4, 6)

val result = intersectionOfSets(set1, set2)
/**
 * This exercise aims to test your understanding of set intersection and slicing in Kotlin.
 * Given two sets, set1 and set2, your task is to write a function that returns the intersection of the two sets.
 * To solve this exercise, follow these steps:
 *
 * 1. Find the common elements between set1 and set2.
 * 2. Utilize slicing to sort the resulting intersection in descending order.
 * 3. Return the sorted intersection as the output of the function.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The sorted intersection of set1 and set2.
 */
fun intersectionOfSets(set1: Set<Int>, set2: Set<Int>): List<Int> {
/**
 * This exercise aims to test your understanding of set intersection and slicing in Kotlin.
 * Given two sets, set1 and set2, your task is to write a function that returns the intersection of the two sets.
 * To solve this exercise, follow these steps:
 *
 * 1. Find the common elements between set1 and set2.
 * 2. Utilize slicing to sort the resulting intersection in descending order.
 * 3. Return the sorted intersection as the output of the function.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The sorted intersection of set1 and set2.
 */
fun intersectionOfSets(set1: Set<Int>, set2: Set<Int>): List<Int> {

    val intersection = set1.intersect(set2)  // Find the common elements between set1 and set2
    val sortedIntersection = intersection.sortedDescending()  // Sort the intersection in descending order
    return sortedIntersection
}

// Example usage:
val set1 = setOf(6, 8, 2, 10, 4)
val set2 = setOf(1, 8, 12, 4, 6)

val result = intersectionOfSets(set1, set2)