A permutation and combination algorithm problem

question:
there are three arrays

A1 = ["i1", "i2", "i3", "i4".... "ix"]; x is an integer greater than 2
a2 = ["K1", "K2", "K3", "K4".... "ky"]; y is an integer greater than 2
a3 = [M1 "," m2 "," m3 "," M4 "...." mz "]; z is an integer greater than 2

extract two items from each array. each item can only be used once to form an array of length 6, such as: ["i1", "i2", "M1", "m2", "K1", "K2"], and find all possible arrays.

requires that the same item between any two arrays is less than or equal to 2.

such as

L1 = ["i1", "i2", "M1", "m2", "K1", "K2"];
L2 = ["i1", "i2", "m3", "M4", "K5", "K6"];

the two arrays have two identical items, "i1" and "i2".

, for example,

L1 = ["i1", "i2", "M1", "m2", "K1", "K2"];
L2 = ["i1", "i2", "M1", "M4", "K5", "K6"];

the number of the same items in the two arrays is 3, which are "i1", "i2" and "M1".

May.31,2022

the following is Java pseudo code

use a third-order loop to eliminate data that do not meet the condition (a = = b & & b = = c)

for(int a=0; a<= La; aPP) {
    for(int b=0; b<=Lb; bPP) {
        for(int c=0; c<=Lc; cPP) {
            if( a == b && b ==c ){
                continue;
            }else {
                list.add( new Object(Aa, Bb, Cc) );
            }
        }
    }
}

Note:

  1. La, Lb, Lc denote the length of the array
  2. .
  3. Aa, Bb, Cc denote the corresponding elements in the following table in the array
  4. .
  5. new Object () is just a hint, not really using the Object object
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30735-402a2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30735-402a2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?