cartesian Product Row
The rows of the sets array are treated like elements in sets. The function returns the element stored at the index of the cartesian product of the sets. The index must be between 0 and (n-1), where n is the number of elements in the cartesian product. The elements start at 0. Since the elements of the arrays represent a set, the values must be unique. That is, no duplicates are permitted within an individual array.
Example: val a = intArrayOf(1, 2) val b = intArrayOf(3, 4) val c = intArrayOf(5) val d = intArrayOf(6, 7, 8) val index = 4 val result = cartesianProductRow(array, index) println("The element at index $index is: ${result.joinToString()}")
Prints:
The element at index 4 is: 1, 4, 5, 7
The rows of the sets array are treated like elements in sets. The function returns the element stored at the index of the cartesian product of the sets. The index must be between 0 and (n-1), where n is the number of elements in the cartesian product. The elements start at 0. Since the elements of the arrays represent a set, the values must be unique. That is, no duplicates are permitted within an individual array.