/**
 * Given two lists of tuples, lst1 and lst2,
 * find the intersection of the tuples based on the specified boolean condition.
 *
 * @param lst1 A list of tuples.
 * @param lst2 A list of tuples.
 * @return A list of tuples containing the intersection elements.
 *
 * Example:
 * intersectTuples(listOf(1 to 2, 3 to 4, 5 to 6), listOf(5 to 6, 7 to 8, 9 to 10))
 * Output: [(5, 6)]
 */
fun intersectTuples(lst1: List<Pair<Int, Int>>, lst2: List<Pair<Int, Int>>): List<Pair<Int, Int>> {

    val intersection = mutableListOf<Pair<Int, Int>>()

    // Iterate over each tuple in lst1
    for (tuple1 in lst1) {
        var match = false

        // Iterate over each tuple in lst2
        for (tuple2 in lst2) {
            // Check if tuple1 and tuple2 have the same values at index 0 and index 1
            if (tuple1.first == tuple2.first && tuple1.second == tuple2.second) {
                match = true
                break
            }
        }

        // Check if match is true
        if (match) {
            intersection.add(tuple1)
        }
    }

    return intersection
}
/**
 * Given two lists of tuples, lst1 and lst2,
 * find the intersection of the tuples based on the specified boolean condition.
 *
 * @param lst1 A list of tuples.
 * @param lst2 A list of tuples.
 * @return A list of tuples containing the intersection elements.
 *
 * Example:
 * intersectTuples(listOf(1 to 2, 3 to 4, 5 to 6), listOf(5 to 6, 7 to 8, 9 to 10))
 * Output: [(5, 6)]
 */
fun intersectTuples(lst1: List<Pair<Int, Int>>, lst2: List<Pair<Int, Int>>): List<Pair<Int, Int>> {
/**
 * Given two lists of tuples, lst1 and lst2,
 * find the intersection of the tuples based on the specified boolean condition.
 *
 * @param lst1 A list of tuples.
 * @param lst2 A list of tuples.
 * @return A list of tuples containing the intersection elements.
 *
 * Example:
 * intersectTuples(listOf(1 to 2, 3 to 4, 5 to 6), listOf(5 to 6, 7 to 8, 9 to 10))
 * Output: [(5, 6)]
 */
fun intersectTuples(lst1: List<Pair<Int, Int>>, lst2: List<Pair<Int, Int>>): List<Pair<Int, Int>> {

    val intersection = mutableListOf<Pair<Int, Int>>()

    // Iterate over each tuple in lst1
    for (tuple1 in lst1) {
        var match = false

        // Iterate over each tuple in lst2
        for (tuple2 in lst2) {
            // Check if tuple1 and tuple2 have the same values at index 0 and index 1
            if (tuple1.first == tuple2.first && tuple1.second == tuple2.second) {
                match = true
                break
            }
        }

        // Check if match is true
        if (match) {
            intersection.add(tuple1)
        }
    }

    return intersection
}