Skip to content

Commit b329f41

Browse files
Create 1464-maximum-product-of-two-elements-in-an-array.java
1 parent 0f8511b commit b329f41

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Solution {
2+
public int maxProduct(int[] nums) {
3+
Arrays.sort(nums);
4+
5+
return (nums[nums.length-1]-1)*(nums[nums.length-2] -1);
6+
}
7+
}

0 commit comments

Comments
 (0)