Imports System
Imports System.Linq
Imports System.Collections.Generic
Public Class AClass
Public Shared Function array_contain_consecutive_integers(ByVal arr As Integer()) As Boolean
If arr.Length <= 1 Then
Return True
End If
Dim min As Integer = arr.Min()
Dim max As Integer = arr.Max()
If max - min <> arr.Length - 1 Then
Return False
End If
Dim st As ISet(Of Integer) = New HashSet(Of Integer)()
For Each val As Integer In arr
If st.Contains(val) Then
Return False
End If
st.Add(val)
Next
Return True
End Function
Public Shared Sub Main(ByVal args As String())
Dim arr As Integer() = New Integer() {-2, 3, 0, -1, 4, 2, 1}
If array_contain_consecutive_integers(arr) Then
Console.Write("Yes")
Else
Console.Write("No")
End If
End Sub
End Class
' run:
'
' Yes
'