Your question is Optimize Slow Screen Update Pipeline. 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.
Find the minimum number of grid cells needed to reach a target cell from the top-left corner without exceeding a total cost budget. Each move is 4-directional, and entering a cell adds that cell's cost.
1 <= rows, cols <= 2000 <= times[r][c] <= 10^60 <= budget <= 10^9