View Single Post
  #27  
Old 11-21-2007, 03:14 AM
Crono Crono is offline
:pluffy:
Join Date: Feb 2002
Location: Sweden
Posts: 20,000
Crono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond repute
Using my leet skillz I have created the ultimate:

PHP Code:
//Returns array containing sets of 3 numbers both arrays have ing common
function ex1(arr1arr2) {
  
temp.result = {};
  
temp.pos 0;
  while (
temp.pos temp.arr1.size() - 2) {  //Make sure there's 3 elements left
    
temp.check = {temp.arr1[temp.pos], temp.arr1[temp.pos 1], temp.arr1[temp.pos 2]};
    if (
temp.result.pos(temp.check) < && searchArr(temp.arr2temp.check)) {
      
temp.result.add(temp.check); 
      
temp.pos += 3;  //Set is found, jump over whole set
    
}
    else {
      
temp.pos++;  //Set not found, go to next number
    
}
  }
  return 
temp.result;
}

function 
ArrayComp(array1,array2) {
  if (
temp.array1.size || temp.array2.size 2) {
    
temp.checkarray temp.array2;
    
temp.checkarray.delete(temp.array2.size 1);
    
temp.checkarray.delete(temp.array2.size 2);
    
temp.failarray = new [0];
    for (
temp.0temp.temp.array1.size 3temp.i++) {
      if (
temp.failarray.index(temp.array1[temp.i]) == -1) {
        
temp.var = temp.checkarray.index(temp.array1[temp.i]);
        if (
temp.var == -1) {
          
temp.failarray.add(temp.array1[temp.i]);
        }
        else {
          
temp.dupecheck temp.checkarray;
          while (
temp.var != -1) {
            if (
temp.array1[temp.1] == temp.array2[temp.var + 1]) {
              if (
temp.array1[temp.2] == temp.array2[temp.var + 2]) {
                
temp.returnvar++;
              }
            }
            
temp.dupecheck.replace(temp.var,"x");
            
temp.var = temp.dupecheck.index(temp.array1[temp.i]);
          }
        }
      }
    }
  }
  return 
temp.returnvar;
}  

function 
ex1(a1a2) {
  
temp.out = {};
  
temp.0;
  
temp.sub 0;

  for (
temp.0a.size() - 2i++) {
    if (!(
a[iin b)) continue;
    for (
temp.1a.size() - 1j++) {
      if (!(
a[jin b)) continue;
      for (
temp.1a.size(); k++) {
        if (
a[kin b) list.add({a[i], a[j], a[k]});

function 
S3(arrA,arrB) {
  
temp.intersect.clear();
  
temp.sets.clear();
  if (
arrA.size() > arrB.size()) temp.= {arrB,arrA};
  else                           
temp.= {arrA,arrB};

function 
getSets()
{
  return {{
2,3,5}, {2,3,6}, {2,3,10}, {2,5,6}, {2,5,10}, {2,6,10}, {3,5,6}, {3,5,10}, {3,6,10}, {5,6,10}};

i SO did not copy paste bits from everyone else's scripts
__________________
Reply With Quote