/**
 * Given two lists [lst1] and [lst2], and two indices [idx1] and [idx2], this function returns a new list in which the elements 
 * from [idx1] to [idx2] (inclusive) in [lst1] are replaced by the elements in [lst2].
 *
 * @param lst1 A list of elements (e.g., integers, strings).
 * @param lst2 A list of elements (e.g., integers, strings).
 * @param idx1 An integer representing the starting index.
 * @param idx2 An integer representing the ending index.
 * @return A new list with replaced elements.
 *
 * Example:
 * replaceElements(listOf(1, 2, 3, 4, 5), listOf("a", "b", "c"), 1, 3)
 * Output: [1, "a", "b", "c", 5]
 */
fun replaceElements(lst1: List<Any>, lst2: List<Any>, idx1: Int, idx2: Int): List<Any> {

    return lst1.subList(0, idx1) + lst2 + lst1.subList(idx2 + 1, lst1.size)
}
/**
 * Given two lists [lst1] and [lst2], and two indices [idx1] and [idx2], this function returns a new list in which the elements 
 * from [idx1] to [idx2] (inclusive) in [lst1] are replaced by the elements in [lst2].
 *
 * @param lst1 A list of elements (e.g., integers, strings).
 * @param lst2 A list of elements (e.g., integers, strings).
 * @param idx1 An integer representing the starting index.
 * @param idx2 An integer representing the ending index.
 * @return A new list with replaced elements.
 *
 * Example:
 * replaceElements(listOf(1, 2, 3, 4, 5), listOf("a", "b", "c"), 1, 3)
 * Output: [1, "a", "b", "c", 5]
 */
fun replaceElements(lst1: List<Any>, lst2: List<Any>, idx1: Int, idx2: Int): List<Any> {
/**
 * Given two lists [lst1] and [lst2], and two indices [idx1] and [idx2], this function returns a new list in which the elements 
 * from [idx1] to [idx2] (inclusive) in [lst1] are replaced by the elements in [lst2].
 *
 * @param lst1 A list of elements (e.g., integers, strings).
 * @param lst2 A list of elements (e.g., integers, strings).
 * @param idx1 An integer representing the starting index.
 * @param idx2 An integer representing the ending index.
 * @return A new list with replaced elements.
 *
 * Example:
 * replaceElements(listOf(1, 2, 3, 4, 5), listOf("a", "b", "c"), 1, 3)
 * Output: [1, "a", "b", "c", 5]
 */
fun replaceElements(lst1: List<Any>, lst2: List<Any>, idx1: Int, idx2: Int): List<Any> {

    return lst1.subList(0, idx1) + lst2 + lst1.subList(idx2 + 1, lst1.size)
}