Largest Triangle Area, by LeetCode
Straightforward problem by LeetCode, here it is https://leetcode.com/problems/largest-triangle-area/description/ : You have a list of points in the plane. Return the area of the largest triangle that can be formed by any 3 of the points. Example: Input: points = [[0,0],[0,1],[1,0],[0,2],[2,0]] Output: 2 Explanation: The five points are show in the figure below. The red triangle is the largest. Given the low range of the input points (max = 50), an N^3 solution should do it here. The key is to find the formula of the area of the triangle given the three coordinates, it can be found here: http://www.mathopenref.com/coordtrianglearea.html . Code is below, many cheers! Marcelo public class Solution { public double LargestTriangleArea(int[][] points) { double largest = -1; for (int i = 0; i < points.Length; i++) { for (int j = i + 1; j < points.Length; j++) { for (int z = j + 1; z < points.Length; z++) { doubl...