Imports System
Public Class AClass
Public Shared Function getMinimumTripletProduct(ByVal arr As Integer()) As Integer
Dim size As Integer = arr.Length
If size <= 2 Then
Return Integer.MaxValue
End If
Array.Sort(arr)
Return Math.Min(arr(size - 1) * arr(size - 2) * arr(0), arr(0) * arr(1) * arr(2))
End Function
Public Shared Sub Main(ByVal args As String())
Dim arr As Integer() = New Integer() {3, 5, 8, 17, 4, 9, 7, 39, 2}
Dim min As Integer = getMinimumTripletProduct(arr)
If min = Integer.MaxValue Then
Console.Write("Array has less than 3 elements")
Else
Console.Write("The minimum product = " & min)
End If
End Sub
End Class
' run:
'
' The minimum product = 24
'