2 LINES CODE IN JAVA  BEATING 99.35% IN 7ms 
Complexity
Time complexity: O(nlogn)

Space complexity: O(1)
Code
![image.png](https://assets.leetcode.com/users/images/0fe7208a-de18-49c3-a9ff-a18dd56a54a3_1737200625.448399.png)


# Complexity
- Time complexity: O(nlogn)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public int largestPerimeter(int[] nums) {
        Arrays.sort(nums);
        int n=nums.length;
        for(int i=n-1;i>=2;i--){
            if(nums[i-2]+nums[i-1]>nums[i]){
                return nums[i-2]+nums[i-1]+nums[i];
            }
        }
        return 0;
    }
}
```
['Java']