Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,866 questions

51,788 answers

573 users

How to check if two arrays have the same set of digits in VB.NET

1 Answer

0 votes
Imports System
				
Public Module Module1
	Public Function have_same_set_of_digits(arr1() As Integer, arr2() As Integer) As Boolean
		Dim len1 As Integer = arr1.Length
		Dim len2 As Integer = arr2.Length
          
		If len1 <> len2 Then
            return false
		End If
        
		For i As Integer = 0 to len1 - 1
			Dim found As Boolean = false
            For j As Integer = 0 to len1 - 1
				If arr1(i) = arr2(j) Then
					found = true
					Exit For
				End If
			Next
			If Not found Then
				return false
			End If
		Next
      
        return true
	End Function

	Public Sub Main()
		Dim arr1() As Integer = { 1, 3, 8, 5, 9, 2 }
        Dim arr2() As Integer = { 2, 9, 1, 8, 2, 5 }
           
		If have_same_set_of_digits(arr1, arr2) = true Then
              Console.WriteLine("Yes")
		Else
             Console.WriteLine("No")
		End If
	End Sub
End Module



' run
'
' No
' 

 



answered Dec 4, 2020 by avibootz

Related questions

...