/**
 * Find the intersection of two lists using membership and slicing.
 *
 * @param lst1 The first list.
 * @param lst2 The second list.
 * @return A new list containing the intersection elements.
 */
fun intersectionMembershipSlicing(lst1: List<Int>, lst2: List<Int>): List<Int> {

    val intersection = mutableListOf<Int>()
    for (item in lst1) {
        if (item in lst2 && item !in intersection) {
            intersection.add(item)
        }
    }
    return intersection
}

// test the function
/**
 * Find the intersection of two lists using membership and slicing.
 *
 * @param lst1 The first list.
 * @param lst2 The second list.
 * @return A new list containing the intersection elements.
 */
fun intersectionMembershipSlicing(lst1: List<Int>, lst2: List<Int>): List<Int> {
/**
 * Find the intersection of two lists using membership and slicing.
 *
 * @param lst1 The first list.
 * @param lst2 The second list.
 * @return A new list containing the intersection elements.
 */
fun intersectionMembershipSlicing(lst1: List<Int>, lst2: List<Int>): List<Int> {

    val intersection = mutableListOf<Int>()
    for (item in lst1) {
        if (item in lst2 && item !in intersection) {
            intersection.add(item)
        }
    }
    return intersection
}

// test the function