## Hackerrank – Compute the Perimeter of a Polygon

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution Calculate a length of a line between each pair of following points p, defined with x and y coordinate: (p0, p1), (p1, p2), …, (pn-1, p0) Length of a line between two points: l = \sqrt{{(x_1 – x_2)}^2 + {(y_1 […]

## Hackerrank – Compute the Area of a Polygon

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution Create matrices of point pairs as follows

… Calculate the determinat of each matrix: x1 * y2 – x2 * y1 And sum the determinants. In the end divide the sum with 2. Solution based on this. I […]