Reported May 2026
Upstart

Bounding Box from Coordinates

Reported by candidates from Upstart's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Upstart OA. Under 2s to a working solution.
Founder's read

Upstart hit you with a bounding box problem in May 2026, and it's simpler than it looks. You get a list of 2D points and need to return the smallest rectangle that contains them all: minX, minY, width, and height. The trap is the output format. Most candidates confuse coordinates with dimensions. Find the min and max of x and y, then subtract. StealthCoder will catch you if you blank on whether width is maxX - minX or maxX - minX + 1.

The problem

You are given a non-empty list of 2D points coordinates, where each point is [x, y]. Return four integers describing the smallest axis-aligned bounding box that covers every point: Function Description Complete the function boundingBoxFromCoordinates in the editor below. boundingBoxFromCoordinates has the following parameter: Returns int[]: [minX, minY, width, height]. The covered x-range is [1, 5] and the y-range is [3, 7], so the width and height are both 4. A single point produces a zero-width, zero-height bounding box rooted at that point.

Reported by candidates. Source: FastPrep

Pattern and pitfall

This is a straightforward min-max scan over two dimensions. Iterate through all points once, tracking minX, maxX, minY, maxY. Width is maxX - minX. Height is maxY - minY. Not a sorting or tree problem. The gotcha is the edge case: a single point has zero width and zero height, rooted at that point. Some candidates add 1 to the width and height because they're thinking in terms of inclusive ranges or grid cells. Don't. The problem is asking for the span, not the count. If you blank on the logic in the live OA, StealthCoder will feed you the pattern instantly so you can code confidently.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Bounding Box from Coordinates cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Upstart's OA.

Upstart reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Bounding Box from Coordinates FAQ

Is this really just four passes through the list?+

Yes. One pass to find minX, maxX, minY, maxY. Then four arithmetic operations. O(n) time, O(1) space. No sorting, no data structure tricks. It's a filtering warm-up, not a hard problem.

Why do people fail the single-point case?+

They add 1 to width or height thinking it's inclusive. The problem says a single point produces zero-width, zero-height. If min and max are the same, the span is 0. That's it.

What if the list is huge?+

Doesn't matter. You're doing one O(n) pass. You can't do better. No optimization needed. The OA will give you a reasonable input size.

Do I need to handle negative coordinates?+

Yes, but it doesn't change the logic. Min and max work the same way with negative numbers. Just find the smallest and largest x and y values, then compute the span.

Should I validate the input or worry about edge cases beyond one point?+

The problem says non-empty list, so you don't need to check for that. One point is the edge case. Beyond that, just code the straightforward solution. Upstart isn't testing defensive programming here.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Upstart.

OA at Upstart?
Invisible during screen share
Get it