Problem · Array

Coordinate Bounding Box

Learn this problem
EasyUpstartFULLTIMEOA

Problem statement

Given a list of two-dimensional points (x, y), return [minX, minY, width, height], where width = maxX - minX and height = maxY - minY.

Function

boundingBox(points: int[][]) → int[]

Examples

Example 1

points = [[2,5],[-1,3],[4,9]]return = [-1,3,5,6]

The minimum corner is (-1,3). The width is 4 - (-1) = 5, and the height is 9 - 3 = 6.

More Upstart problems

drafts saved locally
public int[] boundingBox(int[][] points) {
  // write your code here
}
points[[2,5],[-1,3],[4,9]]
expected[-1,3,5,6]
checking account