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()-; i>; i--)
{
if(A[i]<A[i-]+A[i-]) return A[i]+A[i-]+A[i-];
}
return ;
}
};
参考
1. Leetcode_easy_976. Largest Perimeter Triangle;
完