Bounding Box Overlap
Given a main axis-aligned bounding box (x1, y1, x2, y2) and a list of other axis-aligned bounding boxes, write a function that computes the total area inside the main bounding box covered by the union of the other boxes. Boxes may overlap (overlapping regions should only be counted once), and boxes may lie partially or completely outside the main bounding box (only the portion inside the main bounding box should be considered).
Asked at:
QSC
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late April, 2026
QSC
Senior
You are given a main axis-aligned bounding box (x1, y1, x2, y2) and a list of other axis-aligned bounding boxes. Write a function that computes the total area inside the main bounding box that is covered by the union of the other boxes. Notes: - Boxes may overlap. - Overlapping regions should only be counted once. - Boxes may lie partially or completely outside the main bounding box. - Only the portion inside the main bounding box should be considered.
Hello Interview Premium
Your account is free and you can post anonymously if you choose.