← Squarepoint Interview Insights
Started with a brute-force approach, counting n-3 diagonals from the first vertex, n-4 from the second, and so on.
Start by explaining that each vertex can connect to n-3 other vertices (excluding itself and its two adjacent vertices), giving n(n-3) connections. Since each diagonal is counted twice (once from each endpoint), divide by 2 to get n(n-3)/2. Then verify with small cases like a square (n=4) and pentagon (n=5) to ensure correctness.
Pro tip: Mention that this is a classic combinatorics problem and that the same reasoning applies to counting edges in a complete graph minus the polygon's sides. Also, be prepared to discuss edge cases like n<3 where no diagonals exist.
Clarify that a diagonal connects two non-adjacent vertices of a polygon. For n<3, there are no diagonals.
From any vertex, you can draw diagonals to all other vertices except itself and its two adjacent vertices, so n-3 diagonals per vertex.
Multiply n by (n-3) to get total connections, but each diagonal is counted twice (once from each endpoint), so divide by 2.
The number of diagonals is n(n-3)/2.
Test with n=4 (2 diagonals), n=5 (5 diagonals), and n=6 (9 diagonals) to confirm the formula.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.