/**
 * Given an array, replace the negative values within the specified range with the given replacement value.
 *
 * @param array The original array.
 * @param start The starting index of the range.
 * @param stop The ending index of the range (exclusive).
 * @param replacement The value with which to replace the negative elements.
 * @return The modified array with negative values replaced.
 *
 * Example:
 * replaceNegatives(arrayOf(1, -2, 3, -4, 5, -6, 7), 2, 5, 0)
 * Output: [1, -2, 0, 0, 5, -6, 7]
 */
fun replaceNegatives(array: Array<Int>, start: Int, stop: Int, replacement: Int): Array<Int> {

    for (i in start until stop) {
        if (array[i] < 0) {
            array[i] = replacement
        }
    }
    return array
}
/**
 * Given an array, replace the negative values within the specified range with the given replacement value.
 *
 * @param array The original array.
 * @param start The starting index of the range.
 * @param stop The ending index of the range (exclusive).
 * @param replacement The value with which to replace the negative elements.
 * @return The modified array with negative values replaced.
 *
 * Example:
 * replaceNegatives(arrayOf(1, -2, 3, -4, 5, -6, 7), 2, 5, 0)
 * Output: [1, -2, 0, 0, 5, -6, 7]
 */
fun replaceNegatives(array: Array<Int>, start: Int, stop: Int, replacement: Int): Array<Int> {
/**
 * Given an array, replace the negative values within the specified range with the given replacement value.
 *
 * @param array The original array.
 * @param start The starting index of the range.
 * @param stop The ending index of the range (exclusive).
 * @param replacement The value with which to replace the negative elements.
 * @return The modified array with negative values replaced.
 *
 * Example:
 * replaceNegatives(arrayOf(1, -2, 3, -4, 5, -6, 7), 2, 5, 0)
 * Output: [1, -2, 0, 0, 5, -6, 7]
 */
fun replaceNegatives(array: Array<Int>, start: Int, stop: Int, replacement: Int): Array<Int> {

    for (i in start until stop) {
        if (array[i] < 0) {
            array[i] = replacement
        }
    }
    return array
}