problem 812. Largest Triangle Area solution: class Solution { public: double largestTriangleArea(vector<vector<int>>& points) { double res = 0.0; , y1=, x2=, y2=, x3=, y3=; ; i<points.size(); ++i) { ; j<points.size(); ++j) { ; k<p…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 三重循环 组合函数 日期 题目地址: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…
题目要求 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. 题目分析及思路 给定一个平面上的一组点,要求得到由这些点中任意三个所能组成最大面积的三角形.可以对这一组点进行三三组合,然后利用已知三点求三角形面积的公式得到每一组点所对应的三角形面积,最后取其中的最大值即为所求. python代码 class…
problem 976. Largest Perimeter Triangle solution: class Solution { public: int largestPerimeter(vector<int>& A) { sort(A.begin(), A.end());//decrease. ; i>; i--) { ]+A[i-]) ]+A[i-]; } ; } }; 参考 1. Leetcode_easy_976. Largest Perimeter Triangle…
problem 949. Largest Time for Given Digits solution: class Solution { public: string largestTimeFromDigits(vector<int>& A) { sort(A.begin(), A.end(), greater<int>());//errr..largest.. do { ]< || (A[]==&&A[]<)) && A[]&…
problem 747. Largest Number At Least Twice of Others 题意: solution1: class Solution { public: int dominantIndex(vector<int>& nums) { , secondMx = -, mxId = -;//err... ) ; ; i<nums.size(); i++) { if(nums[i]>mx) { secondMx = mx; mx = nums[i];…
static int wing=[]() { std::ios::sync_with_stdio(false); cin.tie(NULL); ; }(); class Solution { public: double largestTriangleArea(vector<vector<int>>& points) { ; for(auto &i:points) for(auto &j:points) for(auto &k:points) res…
[LeetCode]764. Largest Plus Sign 解题报告(Python) 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址:https://leetcode.com/problems/largest-plus-sign/description/ 题目描述: In a 2D grid from (0, 0) to (N-1, N-1), every cell contains a 1, except thos…
[LeetCode]Pascal's Triangle II 解题报告 标签(空格分隔): LeetCode 题目地址:https://leetcode.com/problems/pascals-triangle-ii/description/ 题目描述: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Return [1,3,3,1]. Note: Could yo…
[LeetCode]813. Largest Sum of Averages 解题报告(Python) 标签(空格分隔): LeetCode 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址:https://leetcode.com/problems/largest-sum-of-averages/description/ 题目描述: We partition a row of numbers A into at most…