Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

3D Bounding Box IoU

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is 3D Bounding Box IoU. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Given two axis-aligned 3D bounding boxes, implement a function that returns their Intersection over Union (IoU) as a floating-point number. Each box is represented as [x1, y1, z1, x2, y2, z2], where (x1, y1, z1) is the minimum corner and (x2, y2, z2) is the maximum corner.

Constraints

  • Each box has exactly 6 numeric values
  • x1 <= x2, y1 <= y2, z1 <= z2 for each box
  • Coordinates are in the range -10^6 to 10^6
  • Boxes are axis-aligned

Function Signature

def iou_3d(box1, box2):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output