Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Smallest Bounding Box for Point Cloud
00:00
5 left

Smallest Bounding Box for Point Cloud

HardPython

Problem

Align Technology's ClinCheck software can analyze 2D projections of intraoral scans. Given a finite point cloud, find the minimum-area rectangle that contains every point, allowing the rectangle to have any orientation.

Return the rectangle's area, width, height, and orientation. The orientation is the angle in radians between the rectangle's width side and the positive x-axis, normalized to the interval [0, π/2).

Formal Specification

Implement minimum_bounding_box(points), where points is a list of distinct or repeated 2D points represented as [x, y]. Return [area, width, height, angle], with every numeric value rounded to six decimal places. If multiple rectangles have the same minimum area, any one is valid.

The minimum-area rectangle has at least one side collinear with an edge of the point cloud's convex hull. Therefore, first compute the convex hull, then evaluate each hull-edge orientation.

Constraints

  • 1 <= len(points) <= 2,000
  • Each point has exactly two coordinates
  • Coordinates are finite real numbers in [-10^6, 10^6]
  • Repeated points may occur
  • Output values must be rounded to six decimal places
  • Multiple minimum-area rectangles may exist

Function Signature

def minimum_bounding_box(points):
Interviewer

Your question is Smallest Bounding Box for Point Cloud. 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
Sign up free to run your codeLog inLn 2
Run your code to see test output here.