/**
 * Given two lists of numbers, find the intersection (common elements) of the two lists.
 * Return a new list containing the common elements.
 *
 * @param numbers1 First list of numbers.
 * @param numbers2 Second list of numbers.
 * @return New list containing the common elements of numbers1 and numbers2.
 *
 * Example:
 * listIntersection(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 */
fun listIntersection(numbers1: List<Int>, numbers2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    for (num in numbers1) {
        if (num in numbers2) {
            commonElements.add(num)  // Add the common element to the list
        }
    }

    return commonElements
}
/**
 * Given two lists of numbers, find the intersection (common elements) of the two lists.
 * Return a new list containing the common elements.
 *
 * @param numbers1 First list of numbers.
 * @param numbers2 Second list of numbers.
 * @return New list containing the common elements of numbers1 and numbers2.
 *
 * Example:
 * listIntersection(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 */
fun listIntersection(numbers1: List<Int>, numbers2: List<Int>): List<Int> {
/**
 * Given two lists of numbers, find the intersection (common elements) of the two lists.
 * Return a new list containing the common elements.
 *
 * @param numbers1 First list of numbers.
 * @param numbers2 Second list of numbers.
 * @return New list containing the common elements of numbers1 and numbers2.
 *
 * Example:
 * listIntersection(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 */
fun listIntersection(numbers1: List<Int>, numbers2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    for (num in numbers1) {
        if (num in numbers2) {
            commonElements.add(num)  // Add the common element to the list
        }
    }

    return commonElements
}