Problem · Array
Coordinate Bounding Box
Learn this problemProblem 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.