/**
 * Given two tuples, 'tuple1" and 'tuple2`, and a positive integer 'n`, this function
 * concatenates 'tuple2" to 'tuple1" n number of times and returns the resulting tuple.
 *
 * @param tuple1 The first tuple.
 * @param tuple2 The second tuple.
 * @param n The number of times to repeat 'tuple2`.
 * @return The concatenated tuple.
 *
 * Example:
 * concatenateRepeatTuple(listOf(1, 2, 3), listOf('a', 'b'), 3)
 * Output: [1, 2, 3, 'a', 'b', 'a', 'b', 'a', 'b']
 */
fun concatenateRepeatTuple(tuple1: List<Any>, tuple2: List<Any>, n: Int): List<Any> {

    // Concatenate 'tuple2" to 'tuple1" n number of times
    val result = tuple1 + List(n) { tuple2 }.flatten()
    return result
}
/**
 * Given two tuples, 'tuple1" and 'tuple2`, and a positive integer 'n`, this function
 * concatenates 'tuple2" to 'tuple1" n number of times and returns the resulting tuple.
 *
 * @param tuple1 The first tuple.
 * @param tuple2 The second tuple.
 * @param n The number of times to repeat 'tuple2`.
 * @return The concatenated tuple.
 *
 * Example:
 * concatenateRepeatTuple(listOf(1, 2, 3), listOf('a', 'b'), 3)
 * Output: [1, 2, 3, 'a', 'b', 'a', 'b', 'a', 'b']
 */
fun concatenateRepeatTuple(tuple1: List<Any>, tuple2: List<Any>, n: Int): List<Any> {
/**
 * Given two tuples, 'tuple1" and 'tuple2`, and a positive integer 'n`, this function
 * concatenates 'tuple2" to 'tuple1" n number of times and returns the resulting tuple.
 *
 * @param tuple1 The first tuple.
 * @param tuple2 The second tuple.
 * @param n The number of times to repeat 'tuple2`.
 * @return The concatenated tuple.
 *
 * Example:
 * concatenateRepeatTuple(listOf(1, 2, 3), listOf('a', 'b'), 3)
 * Output: [1, 2, 3, 'a', 'b', 'a', 'b', 'a', 'b']
 */
fun concatenateRepeatTuple(tuple1: List<Any>, tuple2: List<Any>, n: Int): List<Any> {

    // Concatenate 'tuple2" to 'tuple1" n number of times
    val result = tuple1 + List(n) { tuple2 }.flatten()
    return result
}