✔ Simple Java solution | with explaination
Logic used -\n perimeter of triangle - summation of sides of triangle (p = l1 + l2 + l3)\n Triangle property - In order to create a triangle, largest side is al
**Logic used -**\n* perimeter of triangle - summation of sides of triangle (**p = l1 + l2 + l3**)\n* Triangle property - In order to create a triangle, largest side is always lesser than the summation of other two sides (**l1 < l2 + l3** considering l1 > l2, l3)\n\n**Explanation -**\n\n1.  we need largest three sides to form a triangle, so better to sort an array.\n2.  loop from the last element and pick last three element, if they satisfy the triangle property then return it.\n3.  Otherwise no solution found, return 0 \n\n\n```\nclass Solution {\n    public int largestPerimeter(int[] nums) {\n        Arrays.sort(nums);\n        int last = nums.length-1;\n        while(last-1 > 0){\n            if(nums[last] < nums[last-1] + nums[last-2]) // triangle property => largest size < addition of other two sides\n                return nums[last] + nums[last-1] + nums[last-2];\n            last--;\n        }\n        return 0;\n    }\n}\n```\nTC - O(nlogn)\nSC - O(1)\n***Please upvote if you understood the solution, comment if you have any doubt.***
['Java']