PMMockr

QuestionsTechnical PMTop-Interview

Maximum Number of Visible Points

Focus on developing an algorithm that efficiently calculates the maximum number of distinct trees visible from a fixed position on the hill. Start by determining the angle of each tree relative to your position, using trigonometric functions to compute the angle based on their coordinates. Next, sort the trees by angle and iterate through them, keeping track of the maximum height encountered as you process each tree. If a tree's height is greater than the maximum height recorded for its angle, it is considered visible. Ensure your solution accounts for the specified viewing angle constraint, and discuss how you would handle edge cases, such as trees at the same angle or varying heights.

What this question tests

Practise this question under interview conditions. Answer it out loud against a timer with an AI interviewer that asks follow-ups, then review the scored report.

Start a timed mock interview

Related Technical PM questions

All Technical PM questions · Product manager interview questions by skill area