Dsa
Math
Medium
Polygon Area Calculator
Given a set of points in 2D representing the vertices of a polygon, calculate the area of the polygon using the Shoelace formula. The input consists of an integer N followed by N pairs of integers (x, y) for the coordinates of each vertex. The vertices are supplied in clockwise or counter-clockwise order. The output should be the area of the polygon rounded to two decimal places.
Example Input:
4
0 0
4 0
4 3
0 4
Example Output:
12.00
Key concepts
geometrymathalgorithms
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