/**
 * Given an array arr, replace all occurrences of old_value with new_value.
 *
 * Example:
 * arr = [1, 2, 3, 2, 4, 2, 5]
 * old_value = 2
 * new_value = 10
 * Output: [1, 10, 3, 10, 4, 10, 5]
 */
fun replaceElements(arr: List<Int>, oldValue: Int, newValue: Int): List<Int> {

    val result = arr.map { if (it == oldValue) newValue else it }
    return result
}
/**
 * Given an array arr, replace all occurrences of old_value with new_value.
 *
 * Example:
 * arr = [1, 2, 3, 2, 4, 2, 5]
 * old_value = 2
 * new_value = 10
 * Output: [1, 10, 3, 10, 4, 10, 5]
 */
fun replaceElements(arr: List<Int>, oldValue: Int, newValue: Int): List<Int> {
/**
 * Given an array arr, replace all occurrences of old_value with new_value.
 *
 * Example:
 * arr = [1, 2, 3, 2, 4, 2, 5]
 * old_value = 2
 * new_value = 10
 * Output: [1, 10, 3, 10, 4, 10, 5]
 */
fun replaceElements(arr: List<Int>, oldValue: Int, newValue: Int): List<Int> {

    val result = arr.map { if (it == oldValue) newValue else it }
    return result
}