/**
 * You are given two lists containing integers.
 *
 * Your task is to find the intersection of the two lists, i.e., the elements that appear in both lists.
 *
 * Complete the 'intersectionLists' function below which takes in two lists as input and returns
 * a new list that contains only the elements which are present in both input lists.
 *
 * Example:
 * Input:
 * list1 = [1, 2, 3, 4, 5, 10, 15]
 * list2 = [3, 4, 5, 6, 7, 15]
 *
 * Output:
 * [3, 4, 5, 15]
 *
 * Note:
 * - The order of elements in the output list does not matter.
 * - If there are duplicate elements in any list, they should be considered as separate elements.
 */
fun intersectionLists(list1: List<Int>, list2: List<Int>): List<Int> {

    val intersection = mutableListOf<Int>()

    // Complete the code to find the intersection of the two lists
    for (num1 in list1) {
        for (num2 in list2) {
            if (num1 == num2) {
                intersection.add(num1)
            }
        }
    }

    return intersection
}
/**
 * You are given two lists containing integers.
 *
 * Your task is to find the intersection of the two lists, i.e., the elements that appear in both lists.
 *
 * Complete the 'intersectionLists' function below which takes in two lists as input and returns
 * a new list that contains only the elements which are present in both input lists.
 *
 * Example:
 * Input:
 * list1 = [1, 2, 3, 4, 5, 10, 15]
 * list2 = [3, 4, 5, 6, 7, 15]
 *
 * Output:
 * [3, 4, 5, 15]
 *
 * Note:
 * - The order of elements in the output list does not matter.
 * - If there are duplicate elements in any list, they should be considered as separate elements.
 */
fun intersectionLists(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * You are given two lists containing integers.
 *
 * Your task is to find the intersection of the two lists, i.e., the elements that appear in both lists.
 *
 * Complete the 'intersectionLists' function below which takes in two lists as input and returns
 * a new list that contains only the elements which are present in both input lists.
 *
 * Example:
 * Input:
 * list1 = [1, 2, 3, 4, 5, 10, 15]
 * list2 = [3, 4, 5, 6, 7, 15]
 *
 * Output:
 * [3, 4, 5, 15]
 *
 * Note:
 * - The order of elements in the output list does not matter.
 * - If there are duplicate elements in any list, they should be considered as separate elements.
 */
fun intersectionLists(list1: List<Int>, list2: List<Int>): List<Int> {

    val intersection = mutableListOf<Int>()

    // Complete the code to find the intersection of the two lists
    for (num1 in list1) {
        for (num2 in list2) {
            if (num1 == num2) {
                intersection.add(num1)
            }
        }
    }

    return intersection
}