Practice Maximum Number of Visible Points
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given an array points, an integer angle, and your location, where location = [posx, posy] and points[i] = [xi, yi] both denote integral coordinates on the X-Y plane. Initially, you are facing directly east from your position. You cannot move from your position, but you can rotate. In other words, posx and posy cannot be changed. Your field of view in degrees is represented by angle, determining how wide you can see from any given view direction. Let d be the amount in degrees that you rotate counterclockwise. Then, your field of view is the inclusive range of angles [d - angle/2, d + angle/2]. Your browser does not support the video tag or this video format. You can see some set of points if, for each point, the angle formed by the point, your position, and the immediate east direction from your position is in your field of view. There can be multiple points at one coordinate. There may be points at your location, and you can always see these points regardless of your rotation. Points do not obstruct your vision to other points. Return the maximum number of points you can see.
Source: Maximum Number of Visible Points on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
points = [[2,1],[2,2],[3,3]], angle = 90, location = [1,1]
3
# Example 2
points = [[2,1],[2,2],[3,4],[1,1]], angle = 90, location = [1,1]
4
# Example 3
points = [[1,0],[2,1]], angle = 13, location = [1,1]
1
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum Number of Visible Points.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.