/**
 * Given a nested list, replace all occurrences of the old value with the new value.
 *
 * @param nestedList A nested list of integers.
 * @param oldValue The value to be replaced.
 * @param newValue The new value to replace with.
 * @return The updated nested list with replaced elements.
 */
fun replaceNestedElements(nestedList: List<MutableList<Int>>, oldValue: Int, newValue: Int): List<MutableList<Int>> {

    for (sublist in nestedList) {
        for (i in sublist.indices) {
            if (sublist[i] == oldValue) {
                sublist[i] = newValue
            }
        }
    }
    return nestedList
}
/**
 * Given a nested list, replace all occurrences of the old value with the new value.
 *
 * @param nestedList A nested list of integers.
 * @param oldValue The value to be replaced.
 * @param newValue The new value to replace with.
 * @return The updated nested list with replaced elements.
 */
fun replaceNestedElements(nestedList: List<MutableList<Int>>, oldValue: Int, newValue: Int): List<MutableList<Int>> {
/**
 * Given a nested list, replace all occurrences of the old value with the new value.
 *
 * @param nestedList A nested list of integers.
 * @param oldValue The value to be replaced.
 * @param newValue The new value to replace with.
 * @return The updated nested list with replaced elements.
 */
fun replaceNestedElements(nestedList: List<MutableList<Int>>, oldValue: Int, newValue: Int): List<MutableList<Int>> {

    for (sublist in nestedList) {
        for (i in sublist.indices) {
            if (sublist[i] == oldValue) {
                sublist[i] = newValue
            }
        }
    }
    return nestedList
}