-
976. Largest Perimeter Triangle javaLeetCode_Study_Plan/Programming Skills 2022. 9. 19. 21:39
https://leetcode.com/problems/largest-perimeter-triangle
class Solution { public int largestPerimeter(int[] nums) { Arrays.sort(nums); for (int i = nums.length-1; i>=2 ; i--) { if (nums[i] < nums[i-1] + nums[i-2]){ return nums[i] + nums[i-1] + nums[i-2]; } } return 0; } }
'LeetCode_Study_Plan > Programming Skills' 카테고리의 다른 글
1822. Sign of the Product of an Array java (0) 2022.09.19 1779. Find Nearest Point That Has the Same X or Y Coordinate java (0) 2022.09.19 1281. Subtract the Product and Sum of Digits of an Integer java (0) 2022.09.19 191. Number of 1 Bits java (1) 2022.09.19 1491. Average Salary Excluding the Minimum and Maximum Salary python java (1) 2022.09.19