Dsa
Math
Hard
Polygon Area Calculation
Given a list of vertices of a convex polygon in the form of (x1, y1), (x2, y2), ..., (xn, yn), calculate the area of the polygon. The vertices are provided in clockwise order. The number of vertices, n, can be at least 3 and at most 1000.
Input format:
- The first line contains a single integer n, the number of vertices.
- Each of the following n lines contains two integers x and y, coordinates of the vertices.
Output format:
- A single float rounded to two decimal places representing the area of the polygon.
Example:
Input:
4
0 0
4 0
4 3
0 4
Output:
12.00
Key concepts
geometryareamath
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now