C++ 4 lines, O(n log n)
The goal is to find the largest number n1, where two other numbers, n2 and n3, exist, and  n1 > n2 && n1 > n3, and n1 < n2 + n3.\nIf we sort our sizes, we just 
The goal is to find the largest number n1, where two other numbers, n2 and n3, exist, and  ```n1 > n2 && n1 > n3```, and ```n1 < n2 + n3```.\nIf we sort our sizes, we just need to find the largest A[i] such as ```A[i] < A[i - 1] + A[i - 2]```. So, we analyze triplets largest to smallest, and return the perimeter for the first triplet that matches our criterion.\n```\nint largestPerimeter(vector<int>& A) {\n  sort(begin(A), end(A));\n  for (auto i = A.size() - 1; i >= 2; --i)\n    if (A[i] < A[i - 1] + A[i - 2]) \n        return A[i] + A[i - 1] + A[i - 2];\n  return 0;\n}\n```
[]