Your question is Viewport Layout Window Aggregation. 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 mobile feed view contains n vertically stacked cards with heights stored in integer array heights, and a viewport of height viewport. During scrolling, rendering all cards is too expensive. Return the smallest contiguous range [start, end] such that the sum of heights[start:end+1] is at least viewport. If multiple ranges have the same length, return the one with the smallest start. If no such range exists, return [-1, -1].
def min_visible_window(heights, viewport):