Solution
C++ []\nclass Solution {\npublic:\n    int largestPerimeter(vector<int>& n) {\n        sort(n.begin(), n.end());\n        for(int i = n.size()-3; i >= 0; i--)\n
```C++ []\nclass Solution {\npublic:\n    int largestPerimeter(vector<int>& n) {\n        sort(n.begin(), n.end());\n        for(int i = n.size()-3; i >= 0; i--)\n        {\n            if(n[i] + n[i+1] > n[i+2])\n            {\n                return n[i] + n[i+1] + n[i+2];\n            }\n        }\n        return 0;\n    }\n};\n```\n\n```Python3 []\nclass Solution:\n    def largestPerimeter(self, nums: List[int]) -> int:\n        nums.sort(reverse=True)\n        for i in range(len(nums) - 2):\n            a = nums[i]\n            b = nums[i+1]\n            c = nums[i+2]\n            if a < b + c:\n                return a + b + c\n        return 0\n```\n\n```Java []\nclass Solution {\n    public int largestPerimeter(int[] nums) {\n        setMaxAtIndexI(nums.length - 1, nums);\n        setMaxAtIndexI(nums.length - 2, nums);\n        for (int i = nums.length - 1; i > 1; i--) {\n             setMaxAtIndexI(i - 2, nums);\n            if (nums[i] < nums[i-1] + nums[i-2]) {\n                return nums[i] + nums[i-1] + nums[i-2];\n            }\n        }\n        return 0;\n    }\n    private void setMaxAtIndexI(int index, int [] nums) {\n        int maxValue = 0;\n        int maxValueIndex = index;\n\n        for (int i = 0; i <= index; i++) {\n            if (maxValue < nums[i]) {\n                maxValue = nums[i];\n                maxValueIndex = i;\n            }\n        }\n        nums[maxValueIndex] = nums[index];\n        nums[index] = maxValue;\n    }\n}\n```\n
['C++', 'Java', 'Python3']