C++ || Faster Than 97.88% Solution || Easy Code with Comments || O(1) Space
\nclass Solution {\n    \npublic:\n    int largestPerimeter(vector<int>& nums) {\n\t\n\t//Sort The Array\n        sort(nums.begin(), nums.end());\n        \n   
```\nclass Solution {\n    \npublic:\n    int largestPerimeter(vector<int>& nums) {\n\t\n\t//Sort The Array\n        sort(nums.begin(), nums.end());\n        \n        int i = nums.size()-1;\n\t\t\n\t\t//Traverse From back so that we get largest perimeter of valid Triangle\n        while(i>=2)\n        {\n\t\t// s1 Will Be Largest Side\n            int s1 = nums[i];\n            int s2 = nums[i-1];\n            int s3 = nums[i-2];\n           \n\t\t   // Apply Triangle Side i.e. Sum of Smaller Two Sides is greater Than Largest Side\n            if(s1 < s3 + s2)\n                return s1 + s2 +s3;\n            i--;\n        }\n        \n\t\t// if no valid triangle return 0\n        return 0;\n    }\n};\n```
['C']