/**
 * Given a list of data, replace a specified range of elements with zeros.
 *
 * @param data A list of numeric values.
 * @param start The starting index of the range.
 * @param stop The ending index of the range.
 * @return The modified list with the specified range replaced by zeros.
 *
 * Examples:
 * replaceWithZeros(listOf(1, 2, 3, 4, 5), 1, 3) -> [1, 0, 0, 0, 5]
 * replaceWithZeros(listOf(10, 20, 30, 40, 50), 2, 4) -> [10, 20, 0, 0, 0]
 * replaceWithZeros(listOf(100, 200, 300, 400, 500), 0, 4) -> [0, 0, 0, 0, 0]
 */
fun replaceWithZeros(data: MutableList<Int>, start: Int, stop: Int): List<Int> {

    if (start < 0 || stop >= data.size || start > stop) {
        throw IllegalArgumentException("Invalid range")
    }

    return data.subList(0, start) + List(stop - start + 1) { 0 } + data.subList(stop + 1, data.size)
}
/**
 * Given a list of data, replace a specified range of elements with zeros.
 *
 * @param data A list of numeric values.
 * @param start The starting index of the range.
 * @param stop The ending index of the range.
 * @return The modified list with the specified range replaced by zeros.
 *
 * Examples:
 * replaceWithZeros(listOf(1, 2, 3, 4, 5), 1, 3) -> [1, 0, 0, 0, 5]
 * replaceWithZeros(listOf(10, 20, 30, 40, 50), 2, 4) -> [10, 20, 0, 0, 0]
 * replaceWithZeros(listOf(100, 200, 300, 400, 500), 0, 4) -> [0, 0, 0, 0, 0]
 */
fun replaceWithZeros(data: MutableList<Int>, start: Int, stop: Int): List<Int> {
/**
 * Given a list of data, replace a specified range of elements with zeros.
 *
 * @param data A list of numeric values.
 * @param start The starting index of the range.
 * @param stop The ending index of the range.
 * @return The modified list with the specified range replaced by zeros.
 *
 * Examples:
 * replaceWithZeros(listOf(1, 2, 3, 4, 5), 1, 3) -> [1, 0, 0, 0, 5]
 * replaceWithZeros(listOf(10, 20, 30, 40, 50), 2, 4) -> [10, 20, 0, 0, 0]
 * replaceWithZeros(listOf(100, 200, 300, 400, 500), 0, 4) -> [0, 0, 0, 0, 0]
 */
fun replaceWithZeros(data: MutableList<Int>, start: Int, stop: Int): List<Int> {

    if (start < 0 || stop >= data.size || start > stop) {
        throw IllegalArgumentException("Invalid range")
    }

    return data.subList(0, start) + List(stop - start + 1) { 0 } + data.subList(stop + 1, data.size)
}