/**
 * Deletes all occurrences of a given value in a matrix.
 *
 * @param matrix The matrix to delete elements from.
 * @param value The value to delete from the matrix.
 * @return The updated matrix after deleting all occurrences of the given value.
 */
fun deleteElements(matrix: Array<IntArray>, value: Int): Array<IntArray> {

    for (row in matrix.indices) {
        for (col in matrix[row].indices) {
            if (matrix[row][col] == value) {
                // CODE COMPLETION: Write code to delete the element at (row, col) from the matrix.
                // Use the removeAt method to delete the element.
                matrix[row].toMutableList().removeAt(col)
            }
        }
    }
    return matrix
}

// Example usage
/**
 * Deletes all occurrences of a given value in a matrix.
 *
 * @param matrix The matrix to delete elements from.
 * @param value The value to delete from the matrix.
 * @return The updated matrix after deleting all occurrences of the given value.
 */
fun deleteElements(matrix: Array<IntArray>, value: Int): Array<IntArray> {
/**
 * Deletes all occurrences of a given value in a matrix.
 *
 * @param matrix The matrix to delete elements from.
 * @param value The value to delete from the matrix.
 * @return The updated matrix after deleting all occurrences of the given value.
 */
fun deleteElements(matrix: Array<IntArray>, value: Int): Array<IntArray> {

    for (row in matrix.indices) {
        for (col in matrix[row].indices) {
            if (matrix[row][col] == value) {
                // CODE COMPLETION: Write code to delete the element at (row, col) from the matrix.
                // Use the removeAt method to delete the element.
                matrix[row].toMutableList().removeAt(col)
            }
        }
    }
    return matrix
}

// Example usage