Brighten Image
img is a 2-D array of pixel brightness values from 0 to 255. Add amount to every pixel (it can be negative), but never let a pixel go below 0 or above 255. Return the new array.
Example 1
img [[10,200],[250,128]]
amount 20
returns [[30,220],[255,148]]
250 + 20 would be 270, so it stays at 255.
Constraints
1 <= rows, columns <= 10- Pixels are whole numbers from 0 to 255
-255 <= amount <= 255
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Bucket CountsEasy
- Busiest ColumnEasy
- Change Between RowsEasy
- Close EnoughEasy
- Closest to OriginEasy
- Closest to TargetEasy
- Column MaximumsEasy
- Column WinnersEasy