c++ using sorting
```
class Solution {
public:
    int largestPerimeter(vector<int>& a) {
        sort(a.begin(),a.end());
         // for finding largest perimeter we are iterating arry from backwards
        for(int i=a.size()-1;i>1;i--)
        {
            if(a[i-2]+a[i-1]>a[i])
            {
             return a[i]+a[i-1]+a[i-2];
            }
        }
        return 0;
    }
};

```
['Sorting', 'C++']