Description
Submission
class Solution { public: int largestPerimeter(vector<int>& A) { sort(A.begin(), A.end(), greater<int>()); int n = A.size(); for(int i = 0; i + 2 < n; ++i) { if(A[i] < A[i+1] + A[i+2]) { return A[i] + A[i+1] + A[i+2]; } } return 0; } };