Skip to content

Commit 511dd93

Browse files
committed
Q976 added.
1 parent d6d2fca commit 511dd93

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
public int largestPerimeter(int[] nums) {
3+
Arrays.sort(nums);
4+
for(int i=nums.length-1; i>=2; i--){
5+
if(nums[i]<nums[i-1]+nums[i-2]){
6+
return nums[i]+nums[i-1]+nums[i-2];
7+
}
8+
}
9+
return 0;
10+
}
11+
}

0 commit comments

Comments
 (0)