/**
 * Given an image and a delta value, this function changes the brightness of the image by modifying the pixel values.
 *
 * @param image a 2D list representing the image
 * @param delta an integer representing the value by which the brightness should be changed
 * @return The modified image with updated brightness
 */
fun changeBrightness(image: Array<IntArray>, delta: Int): Array<IntArray> {

    // Obtain the dimensions of the image
    val rows = image.size
    val cols = image[0].size

    // Iterate over each pixel in the image
    for (i in 0 until rows) {
        for (j in 0 until cols) {
            // Modify the pixel value by adding the delta
            image[i][j] += delta

            // Limit the pixel value to the valid range of 0-255
            image[i][j] = image[i][j].coerceIn(0, 255)
        }
    }

    return image
}
/**
 * Given an image and a delta value, this function changes the brightness of the image by modifying the pixel values.
 *
 * @param image a 2D list representing the image
 * @param delta an integer representing the value by which the brightness should be changed
 * @return The modified image with updated brightness
 */
fun changeBrightness(image: Array<IntArray>, delta: Int): Array<IntArray> {
/**
 * Given an image and a delta value, this function changes the brightness of the image by modifying the pixel values.
 *
 * @param image a 2D list representing the image
 * @param delta an integer representing the value by which the brightness should be changed
 * @return The modified image with updated brightness
 */
fun changeBrightness(image: Array<IntArray>, delta: Int): Array<IntArray> {

    // Obtain the dimensions of the image
    val rows = image.size
    val cols = image[0].size

    // Iterate over each pixel in the image
    for (i in 0 until rows) {
        for (j in 0 until cols) {
            // Modify the pixel value by adding the delta
            image[i][j] += delta

            // Limit the pixel value to the valid range of 0-255
            image[i][j] = image[i][j].coerceIn(0, 255)
        }
    }

    return image
}