C++ || O(n) || Sorting || Easy || Basic Triangle Properties
\nclass Solution {\npublic:\n    int largestPerimeter(vector<int>& nums) {\n\t\t\n\t\t// Sort in reverse order.\n        sort(nums.begin(), nums.end(), greater<
```\nclass Solution {\npublic:\n    int largestPerimeter(vector<int>& nums) {\n\t\t\n\t\t// Sort in reverse order.\n        sort(nums.begin(), nums.end(), greater<int>()); \n\t\t\n        int n = nums.size();\n        int i = 0;\n\t\t\n\t\t// Run loop until we satisfy the basic triangle property ( sum of 2 sides >= third side).\n\t\t// As the array is sorted in reverse order we will always get the maximum perimeter.\n        while (i < n - 2 && nums[i] >= nums[i + 1] + nums[i + 2]) {\n            i++;\n        }\n\t\t\n\t\t// If the we are unable to satisfy the property return 0 else the sum of 3 sides.\n        return i >= n - 2 ? 0 : nums[i] + nums[i + 1] + nums[i + 2];\n    }\n};\n```
['C++']