Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0028da6

Browse files
Merge pull requestneetcode-gh#3307 from benmak11/2971
Create 2971-find-polygon-with-the-largest-perimeter.java
2 parents3eb0bda +876ab69 commit0028da6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
publicclassSolution {
2+
3+
publiclonglargestPerimeter(int[]nums) {
4+
Arrays.sort(nums);
5+
longres = -1,amt =0;
6+
7+
for (inti :nums) {
8+
if (amt >i)
9+
res =amt +i;
10+
amt +=i;
11+
}
12+
13+
returnres;
14+
}
15+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp