Imports System
Imports System.Collections.Generic
Public Class Program
Private Shared Function ProductExists(ByVal arr As Integer(), ByVal N As Integer) As Boolean
Dim size As Integer = arr.Length
If size < 2 Then
Return False
End If
Dim st As HashSet(Of Integer) = New HashSet(Of Integer)()
For i As Integer = 0 To size - 1
If arr(i) = 0 AndAlso N = 0 Then
Return True
End If
If N Mod arr(i) = 0 Then
If st.Contains(N / arr(i)) Then
Return True
End If
st.Add(arr(i))
End If
Next
Return False
End Function
Public Shared Sub Main(ByVal args As String())
Dim arr As Integer() = New Integer() {5, 7, 13, 25, 9, 3, 4}
Dim N As Integer = 21
If ProductExists(arr, N) Then
Console.WriteLine("Yes")
Else
Console.WriteLine("No")
End If
End Sub
End Class
' run:
'
' Yes
'