Trains the technique from
LeetCode 812Largest Triangle AreaThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A board holds pegs at whole-number spots given by pegs, where pegs[i] = [x, y], and no two pegs share a spot.
Return the largest area of a triangle whose three corners are pegs. Three pegs standing in a straight line make a triangle of area zero.
Example 1
The three pegs make a right-angled triangle with sides of 3 and 4 along the axes, so the area is half of twelve.
Example 2
All three pegs stand on one line, so the only triangle available has no area.
Example 3
The base runs 2 across and the far peg stands 2 above it, so the area is half of four.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def largest_triangle_area(pegs: list[list[int]]) -> float:public double largestTriangleArea(int[][] pegs)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.