812. Largest Triangle Area Easy
1/**
2 * [812] Largest Triangle Area
3 *
4 * Given an array of points on the X-Y plane points where points[i] = [xi, yi], return the area of the largest triangle that can be formed by any three different points. Answers within 10^-5 of the actual answer will be accepted.
5 *
6 * Example 1:
7 * <img alt="" src="https://s3-lc-upload.s3.amazonaws.com/uploads/2018/04/04/1027.png" style="height: 369px; width: 450px;" />
8 * Input: points = [[0,0],[0,1],[1,0],[0,2],[2,0]]
9 * Output: 2.00000
10 * Explanation: The five points are shown in the above figure. The red triangle is the largest.
11 *
12 * Example 2:
13 *
14 * Input: points = [[1,0],[0,0],[0,1]]
15 * Output: 0.50000
16 *
17 *
18 * Constraints:
19 *
20 * 3 <= points.length <= 50
21 * -50 <= xi, yi <= 50
22 * All the given points are unique.
23 *
24 */
25pub struct Solution {}
26
27// problem: https://leetcode.com/problems/largest-triangle-area/
28// discuss: https://leetcode.com/problems/largest-triangle-area/discuss/?currentPage=1&orderBy=most_votes&query=
29
30// submission codes start here
31
32impl Solution {
33 pub fn largest_triangle_area(points: Vec<Vec<i32>>) -> f64 {
34 0f64
35 }
36}
37
38// submission codes end
39
40#[cfg(test)]
41mod tests {
42 use super::*;
43
44 #[test]
45 fn test_812() {
46 }
47}
48
Back
© 2025 bowen.ge All Rights Reserved.