-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.cs
More file actions
24 lines (24 loc) · 734 Bytes
/
Solution.cs
File metadata and controls
24 lines (24 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
public class Solution
{
public double LargestTriangleArea(int[][] points)
{
int n = points.Length;
double ans = 0;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
for (int k = 0; k < n; k++)
{
if (i == j || j == k || k == i) continue;
double area = 0.5 * (
points[i][0] * (points[j][1] - points[k][1]) +
points[j][0] * (points[k][1] - points[i][1]) +
points[k][0] * (points[i][1] - points[j][1]));
ans = Math.Max(ans, area);
}
}
}
return ans;
}
}