/**
 * Exercise: Intersection of Sets with Ternary Operator and For Loop
 *
 * Given two sets s1 and s2, write a function that returns the intersection of the two sets.
 * The function should use a ternary operator and a for loop.
 *
 * @param s1 The first set.
 * @param s2 The second set.
 * @return The intersection of s1 and s2.
 *
 * Example:
 * intersectionExample(setOf(1, 2, 3, 4), setOf(3, 4, 5, 6)) // Output: setOf(3, 4)
 */
fun intersectionExample(s1: Set<Int>, s2: Set<Int>): Set<Int> {

    val intersection = mutableSetOf<Int>()

    for (elem in s1) {
        if (elem in s2) {
            intersection.add(elem)
        }
    }

    return intersection
}
/**
 * Exercise: Intersection of Sets with Ternary Operator and For Loop
 *
 * Given two sets s1 and s2, write a function that returns the intersection of the two sets.
 * The function should use a ternary operator and a for loop.
 *
 * @param s1 The first set.
 * @param s2 The second set.
 * @return The intersection of s1 and s2.
 *
 * Example:
 * intersectionExample(setOf(1, 2, 3, 4), setOf(3, 4, 5, 6)) // Output: setOf(3, 4)
 */
fun intersectionExample(s1: Set<Int>, s2: Set<Int>): Set<Int> {
/**
 * Exercise: Intersection of Sets with Ternary Operator and For Loop
 *
 * Given two sets s1 and s2, write a function that returns the intersection of the two sets.
 * The function should use a ternary operator and a for loop.
 *
 * @param s1 The first set.
 * @param s2 The second set.
 * @return The intersection of s1 and s2.
 *
 * Example:
 * intersectionExample(setOf(1, 2, 3, 4), setOf(3, 4, 5, 6)) // Output: setOf(3, 4)
 */
fun intersectionExample(s1: Set<Int>, s2: Set<Int>): Set<Int> {

    val intersection = mutableSetOf<Int>()

    for (elem in s1) {
        if (elem in s2) {
            intersection.add(elem)
        }
    }

    return intersection
}