/**
 * Given two tuples, this function returns a new tuple which contains the intersection elements of both
 * tuples, followed by the concatenation of both tuples.
 *
 * @param tuple1 First input tuple
 * @param tuple2 Second input tuple
 * @return New tuple with intersection elements followed by the concatenation of both tuples
 *
 * Example:
 * Given the following inputs:
 * tuple1 = (1, 2, 3, 4)
 * tuple2 = (3, 4, 5, 6)
 *
 * The function should return:
 * (3, 4, 1, 2, 3, 4, 5, 6)
 */
fun intersectionAndConcatenation(tuple1: List<Int>, tuple2: List<Int>): List<Int> {

    // Find the intersection of both tuples
    val intersection = tuple1.intersect(tuple2).toList()

    // Concatenate both tuples
    val concatenated = tuple1 + tuple2

    // Combine intersection and concatenation
    val result = intersection + concatenated

    return result
}
/**
 * Given two tuples, this function returns a new tuple which contains the intersection elements of both
 * tuples, followed by the concatenation of both tuples.
 *
 * @param tuple1 First input tuple
 * @param tuple2 Second input tuple
 * @return New tuple with intersection elements followed by the concatenation of both tuples
 *
 * Example:
 * Given the following inputs:
 * tuple1 = (1, 2, 3, 4)
 * tuple2 = (3, 4, 5, 6)
 *
 * The function should return:
 * (3, 4, 1, 2, 3, 4, 5, 6)
 */
fun intersectionAndConcatenation(tuple1: List<Int>, tuple2: List<Int>): List<Int> {
/**
 * Given two tuples, this function returns a new tuple which contains the intersection elements of both
 * tuples, followed by the concatenation of both tuples.
 *
 * @param tuple1 First input tuple
 * @param tuple2 Second input tuple
 * @return New tuple with intersection elements followed by the concatenation of both tuples
 *
 * Example:
 * Given the following inputs:
 * tuple1 = (1, 2, 3, 4)
 * tuple2 = (3, 4, 5, 6)
 *
 * The function should return:
 * (3, 4, 1, 2, 3, 4, 5, 6)
 */
fun intersectionAndConcatenation(tuple1: List<Int>, tuple2: List<Int>): List<Int> {

    // Find the intersection of both tuples
    val intersection = tuple1.intersect(tuple2).toList()

    // Concatenate both tuples
    val concatenated = tuple1 + tuple2

    // Combine intersection and concatenation
    val result = intersection + concatenated

    return result
}