/**
 * Given two lists, find the intersection of elements between them.
 *
 * @param lst1 The first list.
 * @param lst2 The second list.
 * @return The intersection of elements between lst1 and lst2.
 *
 * Example:
 * '``
 * val lst1 = listOf(1, 2, 3, 4, 5)
 * val lst2 = listOf(4, 5, 6, 7)
 * println(elementIntersection(lst1, lst2)) // Output: [4, 5]
 * '``
 */
fun elementIntersection(lst1: List<Int>, lst2: List<Int>): List<Int> {

    val intersection = mutableListOf<Int>()

    // Iterate through elements in lst1
    for (element in lst1) {
        // Check if element is in lst2
        for (num in lst2) {
            if (element == num) {
                // Add the element to the intersection list
                intersection.add(element)
                break  // Exit the inner loop to avoid duplicates
            }
        }
    }

    return intersection
}
/**
 * Given two lists, find the intersection of elements between them.
 *
 * @param lst1 The first list.
 * @param lst2 The second list.
 * @return The intersection of elements between lst1 and lst2.
 *
 * Example:
 * '``
 * val lst1 = listOf(1, 2, 3, 4, 5)
 * val lst2 = listOf(4, 5, 6, 7)
 * println(elementIntersection(lst1, lst2)) // Output: [4, 5]
 * '``
 */
fun elementIntersection(lst1: List<Int>, lst2: List<Int>): List<Int> {
/**
 * Given two lists, find the intersection of elements between them.
 *
 * @param lst1 The first list.
 * @param lst2 The second list.
 * @return The intersection of elements between lst1 and lst2.
 *
 * Example:
 * '``
 * val lst1 = listOf(1, 2, 3, 4, 5)
 * val lst2 = listOf(4, 5, 6, 7)
 * println(elementIntersection(lst1, lst2)) // Output: [4, 5]
 * '``
 */
fun elementIntersection(lst1: List<Int>, lst2: List<Int>): List<Int> {

    val intersection = mutableListOf<Int>()

    // Iterate through elements in lst1
    for (element in lst1) {
        // Check if element is in lst2
        for (num in lst2) {
            if (element == num) {
                // Add the element to the intersection list
                intersection.add(element)
                break  // Exit the inner loop to avoid duplicates
            }
        }
    }

    return intersection
}