/**
 * This function takes two lists as input and returns a set of common elements found in both lists.
 *
 * @param list1 First list
 * @param list2 Second list
 * @return Set of common elements in list1 and list2
 *
 * Example:
 * commonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // Output: [3, 4]
 */
fun commonElements(list1: List<Int>, list2: List<Int>): Set<Int> {

    val commonElementsSet = mutableSetOf<Int>()

    // Iterate over each element in list1
    for (element1 in list1) {
        // Iterate over each element in list2
        for (element2 in list2) {
            // Check if the elements are equal
            if (element1 == element2) {
                // Add the common element to the set
                commonElementsSet.add(element1)
            }
        }
    }

    return commonElementsSet
}
/**
 * This function takes two lists as input and returns a set of common elements found in both lists.
 *
 * @param list1 First list
 * @param list2 Second list
 * @return Set of common elements in list1 and list2
 *
 * Example:
 * commonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // Output: [3, 4]
 */
fun commonElements(list1: List<Int>, list2: List<Int>): Set<Int> {
/**
 * This function takes two lists as input and returns a set of common elements found in both lists.
 *
 * @param list1 First list
 * @param list2 Second list
 * @return Set of common elements in list1 and list2
 *
 * Example:
 * commonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // Output: [3, 4]
 */
fun commonElements(list1: List<Int>, list2: List<Int>): Set<Int> {

    val commonElementsSet = mutableSetOf<Int>()

    // Iterate over each element in list1
    for (element1 in list1) {
        // Iterate over each element in list2
        for (element2 in list2) {
            // Check if the elements are equal
            if (element1 == element2) {
                // Add the common element to the set
                commonElementsSet.add(element1)
            }
        }
    }

    return commonElementsSet
}