All problems
Taguchi Orthogonal Array Check
Problem
Check whether a design matrix is a balanced orthogonal array.
For every pair of columns, each combination of their level values must occur exactly rows / (levels_i * levels_j) times. Return True when every pair passes; a matrix with fewer than two columns trivially returns True.
Hint
Missing level combinations count as zero occurrences and fail the check.
Test cases
case 1
in: [[[0,0,0],[0,1,1],[1,0,1],[1,1,0]]]
expected: true
case 2
in: [[[0,0],[0,0],[1,1],[1,1]]]
expected: false
case 3
in: [[[0],[1],[0],[1]]]
expected: true
case 4
in: [[[0,0],[0,1],[1,0],[1,1]]]
expected: true
Starter codePython
def taguchi_orthogonal_check(array):
# Your code here
pass4 test cases · run your code against them in the editor