Dsa
Math
Easy
Area of Triangle from Vertices
Given the coordinates of the vertices of a triangle, calculate the area of the triangle using the formula: Area = 1/2 * |x1(y2 − y3) + x2(y3 − y1) + x3(y1 − y2)|. Return the area as an integer.
Input Format:
A single line containing six space-separated integers (x1, y1, x2, y2, x3, y3) where -1000 <= xi, yi <= 1000.
Output Format:
A single integer representing the area of the triangle.
Example:
Input:
0 0 4 0 0 3
Output:
6
Key concepts
mathgeometrytriangle
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