/**
 * You are conducting a study of two different tribes. Each tribe is represented by a set of numbers.
 * Your task is to find the common elements between these two tribes using set comprehension.
 *
 * Complete the commonElements function which takes in two sets: set1 and set2.
 * The function should return a new set containing the common elements found in both set1 and set2.
 *
 * For example:
 * commonElements(setOf(1, 2, 3), setOf(2, 3, 4)) should return setOf(2, 3).
 * commonElements(setOf(10, 20, 30), setOf(30, 40, 50)) should return setOf(30).
 *
 * Your solution must use set comprehension and no additional imports or libraries allowed.
 */
fun commonElements(set1: Set<Int>, set2: Set<Int>): Set<Int> {

    return set1.filter { it in set2 }.toSet()
}
/**
 * You are conducting a study of two different tribes. Each tribe is represented by a set of numbers.
 * Your task is to find the common elements between these two tribes using set comprehension.
 *
 * Complete the commonElements function which takes in two sets: set1 and set2.
 * The function should return a new set containing the common elements found in both set1 and set2.
 *
 * For example:
 * commonElements(setOf(1, 2, 3), setOf(2, 3, 4)) should return setOf(2, 3).
 * commonElements(setOf(10, 20, 30), setOf(30, 40, 50)) should return setOf(30).
 *
 * Your solution must use set comprehension and no additional imports or libraries allowed.
 */
fun commonElements(set1: Set<Int>, set2: Set<Int>): Set<Int> {
/**
 * You are conducting a study of two different tribes. Each tribe is represented by a set of numbers.
 * Your task is to find the common elements between these two tribes using set comprehension.
 *
 * Complete the commonElements function which takes in two sets: set1 and set2.
 * The function should return a new set containing the common elements found in both set1 and set2.
 *
 * For example:
 * commonElements(setOf(1, 2, 3), setOf(2, 3, 4)) should return setOf(2, 3).
 * commonElements(setOf(10, 20, 30), setOf(30, 40, 50)) should return setOf(30).
 *
 * Your solution must use set comprehension and no additional imports or libraries allowed.
 */
fun commonElements(set1: Set<Int>, set2: Set<Int>): Set<Int> {

    return set1.filter { it in set2 }.toSet()
}