problem
976. Largest Perimeter Triangle
solution:
class Solution { public: int largestPerimeter(vector<int>& A) { sort(A.begin(), A.end());//decrease. for(int i=A.size()-1; i>1; i--) { if(A[i]<A[i-1]+A[i-2]) return A[i]+A[i-1]+A[i-2]; } return 0; } };
reference
1. Leetcode_easy_976. Largest Perimeter Triangle;
Finish