FastPrepBounding Box from Coordinates
Problems/Bounding Box from Coordinates

Bounding Box from Coordinates

Upstart logoUpstart● EasyFULLTIMEOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

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:

  1. minX: the minimum x-value
  2. minY: the minimum y-value
  3. width: maxX - minX
  4. height: maxY - minY

Function

boundingBoxFromCoordinates(coordinates: int[][]) → int[]

Complete the function boundingBoxFromCoordinates in the editor below.

boundingBoxFromCoordinates has the following parameter:

  1. int[][] coordinates: the list of points

Returns int[]: [minX, minY, width, height].

Examples

Example 1

coordinates = [[2, 3], [5, 7], [1, 4]]return = [1, 3, 4, 4]

The covered x-range is [1, 5] and the y-range is [3, 7], so the width and height are both 4.

Example 2

coordinates = [[0, 0]]return = [0, 0, 0, 0]

A single point produces a zero-width, zero-height bounding box rooted at that point.

Constraints

  • 1 <= coordinates.length <= 2 * 10^5
  • Each point contains exactly two integers.
  • -10^9 <= x, y <= 10^9

More Upstart Online Assessment questions

  • Buffet Day GainsOA · Seen Sep 2026
  • Case-Insensitive Anagram CheckOA · Seen Sep 2026
  • Filter Duplicates While Preserving OrderOA · Seen Sep 2026
  • Scale Ingredient QuantitiesOA · Seen Sep 2026
  • ABO Parent Genotype CombinationsOA · Seen Aug 2026
  • Chunked Byte Stream ChecksumsOA · Seen Aug 2026
  • Cluster Size on DiskOA · Seen Aug 2026
  • Double Substitution DecryptionOA · Seen Aug 2026
  • Add Drama to Text GroupsOA · Seen Jul 2026
  • Lexicographic Word FrequenciesOA · Seen Jul 2026

Similar questions at other companies

  • Count Colliding Object PairsZipRecruiter · OAZipRecruiter interview questions
  • Count Distinct Tags in a Fixed-Radius Circle (Practice Reconstruction)Marshall Wace · OAMarshall Wace interview questions
  • Count Pairs of Overlapping SquaresCapital One · OACapital One interview questions
  • Count Overlapping Square PairsRamp · OARamp interview questions
  • Starlink Beam PlannerSpaceX · OA · PHONE SCREENSpaceX interview questions
  • Maximum Points in a Perimeter-Bounded RectangleAmerican Express · OAAmerican Express interview questions
  • Best Meeting PointWalmart · OAWalmart interview questions
  • HTTP Request RedirectionAmazon · OA
  • Minimum Euclidean Distance Between PointsLuma AI · OALuma AI interview questions
  • Closest Point to a LineAdobe · OAAdobe interview questions
All Upstart interview questionsSee Upstart hiring insights
Saved
class Solution {
    public int[] boundingBoxFromCoordinates(int[][] coordinates) {
        // write your code here
    }

}
Checking account…