Back to problems

Compute coordinate bounds

Algorithm · Upstart · Easy

Given a non-empty list of two-dimensional integer points, each written as a pair (x, y), determine the axis-aligned bounding box that encloses every point. Report that box as a four-element list [minX, minY, width, height], where minX and minY are the smallest x- and y-coordinates found in the input, and width = maxX - minX while height = maxY - minY use the corresponding largest coordinates. If all points share the same x or y value, the resulting width or height is $$0$$.…

Checking your access…