FunctionRacerProblemsRace

Triangle Area From Points

EasyMathPython, JavaScript, TypeScript, Java, C++

points holds three corners [x, y] of a triangle, all integers. To avoid fractions, return twice the area of the triangle as an integer. If the three points lie on one line, the answer is 0.

Example 1

points [[0,0],[4,0],[0,3]]
returns 12

Area 6, so twice is 12.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems