/**
 * Given an array 'arr', a start index 'sliceStart', an end index 'sliceEnd', a replacement value 'replaceValue',
 * and a multiplier, this function slices the array from 'sliceStart' to 'sliceEnd' inclusive, replaces the sliced
 * elements with 'replaceValue', and multiplies every element in the array by 'multiplier'.
 *
 * @param arr The input array
 * @param sliceStart Start index for slicing
 * @param sliceEnd End index for slicing
 * @param replaceValue The value to replace the sliced elements with
 * @param multiplier The multiplier applied to every element in the array
 * @return The modified array
 */
fun sliceAndReplaceMultiply(arr: IntArray, sliceStart: Int, sliceEnd: Int, replaceValue: Int, multiplier: Int): IntArray {

    // Slicing and replacing elements
    val slicedArr = arr.copyOf()
    for (i in sliceStart..sliceEnd) {
        slicedArr[i] = replaceValue
    }

    // Multiplying elements
    val multipliedArr = slicedArr.map { it * multiplier }.toIntArray()

    return multipliedArr
}
/**
 * Given an array 'arr', a start index 'sliceStart', an end index 'sliceEnd', a replacement value 'replaceValue',
 * and a multiplier, this function slices the array from 'sliceStart' to 'sliceEnd' inclusive, replaces the sliced
 * elements with 'replaceValue', and multiplies every element in the array by 'multiplier'.
 *
 * @param arr The input array
 * @param sliceStart Start index for slicing
 * @param sliceEnd End index for slicing
 * @param replaceValue The value to replace the sliced elements with
 * @param multiplier The multiplier applied to every element in the array
 * @return The modified array
 */
fun sliceAndReplaceMultiply(arr: IntArray, sliceStart: Int, sliceEnd: Int, replaceValue: Int, multiplier: Int): IntArray {
/**
 * Given an array 'arr', a start index 'sliceStart', an end index 'sliceEnd', a replacement value 'replaceValue',
 * and a multiplier, this function slices the array from 'sliceStart' to 'sliceEnd' inclusive, replaces the sliced
 * elements with 'replaceValue', and multiplies every element in the array by 'multiplier'.
 *
 * @param arr The input array
 * @param sliceStart Start index for slicing
 * @param sliceEnd End index for slicing
 * @param replaceValue The value to replace the sliced elements with
 * @param multiplier The multiplier applied to every element in the array
 * @return The modified array
 */
fun sliceAndReplaceMultiply(arr: IntArray, sliceStart: Int, sliceEnd: Int, replaceValue: Int, multiplier: Int): IntArray {

    // Slicing and replacing elements
    val slicedArr = arr.copyOf()
    for (i in sliceStart..sliceEnd) {
        slicedArr[i] = replaceValue
    }

    // Multiplying elements
    val multipliedArr = slicedArr.map { it * multiplier }.toIntArray()

    return multipliedArr
}