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

Commit4f44456

Browse files
add 2908
1 parent38658ee commit4f44456

File tree

2 files changed

+26
-0
lines changed
  • paginated_contents/algorithms/3rd_thousand
  • src/main/java/com/fishercoder/solutions/thirdthousand

2 files changed

+26
-0
lines changed

‎paginated_contents/algorithms/3rd_thousand/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
| 2965|[Find Missing and Repeated Values](https://leetcode.com/problems/find-missing-and-repeated-values/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2965.java)|| Easy|
77
| 2942|[Find Words Containing Character](https://leetcode.com/problems/find-words-containing-character/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2942.java)|| Easy|
88
| 2937|[Make Three Strings Equal](https://leetcode.com/problems/make-three-strings-equal/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2937.java)|| Easy|
9+
| 2908|[Minimum Sum of Mountain Triplets I](https://leetcode.com/problems/minimum-sum-of-mountain-triplets-i/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2908.java)|| Easy|
910
| 2903|[Find Indices With Index and Value Difference I](https://leetcode.com/problems/find-indices-with-index-and-value-difference-i/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2903.java)|| Easy|
1011
| 2900|[Longest Unequal Adjacent Groups Subsequence I](https://leetcode.com/problems/longest-unequal-adjacent-groups-subsequence-i/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2900.java)|| Easy|
1112
| 2899|[Last Visited Integers](https://leetcode.com/problems/last-visited-integers/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2899.java)|| Easy|
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
packagecom.fishercoder.solutions.thirdthousand;
2+
3+
publicclass_2908 {
4+
publicstaticclassSolution1 {
5+
publicintminimumSum(int[]nums) {
6+
intminSum =Integer.MAX_VALUE;
7+
for (inti =0;i <nums.length -2;i++) {
8+
for (intj =i +1;j <nums.length -1;j++) {
9+
if (nums[i] <nums[j]) {
10+
intsum =nums[i] +nums[j];
11+
for (intk =j +1;k <nums.length;k++) {
12+
if (nums[k] <nums[j]) {
13+
sum +=nums[k];
14+
minSum =Math.min(minSum,sum);
15+
sum -=nums[k];
16+
}
17+
}
18+
}
19+
}
20+
}
21+
22+
returnminSum ==Integer.MAX_VALUE ? -1 :minSum;
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp