I’m having a hard time wrapping my head around this problem. I have 2 unsorted arrays that need to be compared, array2 must contain all elements of array1 and array2 can any number of extra elements without affecting the result. I don’t see any benefits from sorting the arrays and comparing the string values as array2 can have extra information causing noise.
var array1:Array;
var array2:Array;
// array2 must contain all elements of array1.
var array1:Array = new Array(1, 5, 6, 7);
var array2:Array = new Array(5, 9, 6, 4, 7, 8);
// comparing this should return false (array2 is missing and element from array1)
var array1:Array = new Array(1, 5, 6, 7);
var array2:Array = new Array(5, 9, 6, 4, 7, 1);
// comparing this should return true (array2 has all the elements of array1)
Any help in the right direction would be greatly appreciated.
Something like this?