Skip to content

Commit

Permalink
add sol
Browse files Browse the repository at this point in the history
  • Loading branch information
ductnn committed Dec 12, 2023
1 parent 1f760b3 commit faad7df
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package main

import (
"fmt"
"sort"
)

func maxProduct(nums []int) int {
sort.Ints(nums)
return (nums[len(nums)-1] - 1) * (nums[len(nums)-2] - 1)
}

func main() {
nums := []int{3, 4, 5, 2}
fmt.Println(maxProduct(nums))
}

0 comments on commit faad7df

Please sign in to comment.