Your question is Bounding Box From 2D Array. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
A Reddit image preview is represented by a non-empty 2D array containing only 1s and 0s. The 1s represent background pixels, while the 0s form one solid, axis-aligned rectangular region. Return the coordinates of that region's upper-left and bottom-right corners.
Implement find_bounding_box(image), where image is a rectangular list of lists of integers. Return [[top_row, left_column], [bottom_row, right_column]]. Coordinates are zero-based, and both corners are inclusive. The input contains at least one 0, and every 0 belongs to the same rectangular region.
def find_bounding_box(image):