PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Aurora

Find viewing direction that sees most points

Last updated: Mar 29, 2026

Quick Overview

This question evaluates computational geometry skills, angular normalization and counting within a sector, and the ability to design algorithms that scale to large inputs.

  • medium
  • Aurora
  • Coding & Algorithms
  • Software Engineer

Find viewing direction that sees most points

Company: Aurora

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are standing at the origin on a 2D plane. You are given a list of points `points[i] = (xi, yi)` (not necessarily distinct), and a viewing angle `theta` in degrees. You may choose any viewing **direction** (a ray starting from the origin). Your field of view is the **closed sector** of angular width `theta` whose central axis is your chosen direction (equivalently, a window of size `theta` when sweeping directions around the origin). A point is considered **visible** if the angle from the positive x-axis to the vector `(xi, yi)` lies within that angular sector (after choosing the sector’s placement). Points exactly on the boundary are visible. If any points are exactly at the origin `(0,0)`, they are always visible regardless of direction. **Task**: Choose a viewing direction that maximizes the number of visible points. **Output**: - Return the maximum number of visible points, and - Return any one viewing direction (e.g., an angle in degrees in `[0, 360)`) that achieves this maximum. **Constraints (typical interview scale)**: - `1 <= n <= 2e5` - `xi, yi` are integers (e.g., in `[-1e9, 1e9]`) - `0 < theta <= 360` Notes: - Angles wrap around at `360°`. - Your solution should be better than `O(n^2)`.

Quick Answer: This question evaluates computational geometry skills, angular normalization and counting within a sector, and the ability to design algorithms that scale to large inputs.

Related Interview Questions

  • Compute streaming sliding-window minimums - Aurora (medium)
  • Implement a reference-counted smart pointer - Aurora (hard)
Aurora logo
Aurora
Jan 6, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
6
0
Loading...

You are standing at the origin on a 2D plane. You are given a list of points points[i] = (xi, yi) (not necessarily distinct), and a viewing angle theta in degrees.

You may choose any viewing direction (a ray starting from the origin). Your field of view is the closed sector of angular width theta whose central axis is your chosen direction (equivalently, a window of size theta when sweeping directions around the origin).

A point is considered visible if the angle from the positive x-axis to the vector (xi, yi) lies within that angular sector (after choosing the sector’s placement). Points exactly on the boundary are visible. If any points are exactly at the origin (0,0), they are always visible regardless of direction.

Task: Choose a viewing direction that maximizes the number of visible points.

Output:

  • Return the maximum number of visible points, and
  • Return any one viewing direction (e.g., an angle in degrees in [0, 360) ) that achieves this maximum.

Constraints (typical interview scale):

  • 1 <= n <= 2e5
  • xi, yi are integers (e.g., in [-1e9, 1e9] )
  • 0 < theta <= 360

Notes:

  • Angles wrap around at 360° .
  • Your solution should be better than O(n^2) .

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Aurora•More Software Engineer•Aurora Software Engineer•Aurora Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.