Skip to content

Commit 569127e

Browse files
committedJul 30, 2024·
add 2873
1 parent 8a7990d commit 569127e

File tree

2 files changed

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

2 files changed

+21
-0
lines changed
 

‎paginated_contents/algorithms/3rd_thousand/README.md

+1
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+
| 2873 | [Maximum Value of an Ordered Triplet I](https://leetcode.com/problems/maximum-value-of-an-ordered-triplet-i/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2873.java) | | Easy |
910
| 2864 | [Maximum Odd Binary Number](https://leetcode.com/problems/maximum-odd-binary-number/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2864.java) | | Easy |Greedy
1011
| 2839 | [Check if Strings Can be Made Equal With Operations I](https://leetcode.com/problems/check-if-strings-can-be-made-equal-with-operations-i/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2839.java) | | Easy |
1112
| 2833 | [Furthest Point From Origin](https://leetcode.com/problems/furthest-point-from-origin/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2833.java) | | Easy |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.fishercoder.solutions.thirdthousand;
2+
3+
public class _2873 {
4+
public static class Solution1 {
5+
public long maximumTripletValue(int[] nums) {
6+
long ans = Long.MIN_VALUE;
7+
for (int i = 0; i < nums.length - 2; i++) {
8+
for (int j = i + 1; j < nums.length - 1; j++) {
9+
for (int k = j + 1; k < nums.length; k++) {
10+
ans = Math.max(ans, (long) (nums[i] - nums[j]) * nums[k]);
11+
}
12+
}
13+
}
14+
if (ans < 0) {
15+
return 0;
16+
}
17+
return ans;
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)
Please sign in to comment.