Maximum Visible Drones
Updated
Problem statement
You stand at location = [x, y] on a flat plane. Each drone sits at a point with whole-number coordinates. You pick one direction to face. Your view is a wedge, like a slice of pie, that is at most angle degrees wide. You can see every drone whose direction from you falls inside this wedge, including drones exactly on its two edges.
A drone at your own location is always visible, no matter which way you face. Several drones may sit on the same point. Return the largest number of drones you can see at once.
Function
maxVisibleDrones(points: int[][], angle: int, location: int[]) → intExamples
Example 1
points = [[2,1],[2,2],[3,3]]angle = 90location = [1,1]return = 3From your location, one drone is straight east and the other two are straight northeast. Facing northeast with a 90-degree view covers all of them, so you see all three drones.
Example 2
points = [[2,1],[2,2],[3,4],[1,1]]angle = 13location = [1,1]return = 3Two drones are at directions of 45 and about 56.3 degrees from you. Both fit inside one view that is 13 degrees wide. The drone straight east is too far around to join them. The last drone is exactly at your location, so it is always visible. That makes three drones in total.
Constraints
1 <= points.length <= 100000.points[i].length == 2andlocation.length == 2.-10^9 <= points[i][j], location[j] <= 10^9.0 <= angle <= 360.
More Anduril interview questions
- Pacific Atlantic Water FlowPHONE SCREEN · Seen Aug 2026
- Choose the Front Football TeamPHONE SCREEN · Seen May 2026
- Build a Sorted Circular Singly Linked ListPHONE SCREEN · Seen Feb 2024
- Sparse Vector Dot ProductPHONE SCREEN · Seen Apr 2021
- Add Word and Suffix SearchONSITE INTERVIEW · Seen Aug 2026
- Binary Tree Preorder TraversalONSITE INTERVIEW · Seen Aug 2026
- Operator-First Array CalculatorONSITE INTERVIEW · Seen Aug 2026
- Daily TemperaturesONSITE INTERVIEW · Seen Jun 2024
- Highlighted Context WindowsONSITE INTERVIEW · Seen Jun 2024
Similar questions at other companies
- K Closest Points to the OriginWhatNot · PHONE SCREENWhatNot interview questions
- Optimal Central WarehouseGoogle · ONSITE INTERVIEWGoogle interview questions
- Light Source Hits: Sample, Compare, and FitOpenAI · PHONE SCREENOpenAI interview questions
- Max Points on a LineUber · PHONE SCREENUber interview questions
- Detect Security Attacks from Network LogsFireworks AI · PHONE SCREEN
- Smallest Range Covering Elements from K ListsSnap Inc. · PHONE SCREENSnap Inc. interview questions
- Closest Pair of PointsCitadel · PHONE SCREENCitadel interview questions
- Sliding Window Attention over a KV CacheNVIDIA · PHONE SCREENNVIDIA interview questions
- Employee Count Median, Mean and ModeClay · PHONE SCREEN
- Three Points in a Semicircle: Monte Carlo EstimateSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions