Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
3D Bounding Box IoU
00:00
5 left

3D Bounding Box IoU

EasyPython

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):
Interviewer

Your question is 3D Bounding Box IoU. Start with the requirements in the Question tab.

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.
CodePython 3
You need to log in / sign up to run or submit.Ln 2
Run your code to see test output here.