Cody

# Problem 534. Find best domino orientation

Solution 1082955

Submitted on 16 Dec 2016 by steph26
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
list = [5 2 3 7 4 9 2 3 8 2 3 5 8 2 7 8 4 2 8 2]; y_correct = [0 0 1 1 1 1 1 1 0 1]; assert(isequal(findBestDominoeOrientation(list),y_correct))

res = 5 2 3 7 4 9 2 3 8 2 3 5 8 2 7 8 4 2 8 2 res = 5 2 3 7 4 9 2 3 8 2 3 5 8 2 7 8 4 2 2 8 res = 5 2 3 7 4 9 2 3 8 2 3 5 8 2 7 8 2 4 8 2 res = 5 2 3 7 4 9 2 3 8 2 3 5 8 2 7 8 2 4 2 8 res = 5 2 3 7 4 9 2 3 8 2 3 5 8 2 8 7 4 2 8 2 res = 5 2 3 7 4 9 2 3 8 2 3 5 8 2 8 7 4 2 2 8 res = 5 2 3 7 4 9 2 3 8 2 3 5 8 2 8 7 2 4 8 2 res = 5 2 3 7 4 9 2 3 8 2 3 5 8 2 8 7 2 4 2 8 res = 5 2 3 7 4 9 2 3 8 2 3 5 2 8 7 8 4 2 8 2 res = 5 2 3 7 4 9 2 3 8 2 3 5 2 8 7 8 4 2 2 8 res = 5 2 3 7 4 9 2 3 8 2 3 5 2 8 7 8 2 4 8 2 res = 5 2 3 7 4 9 2 3 8 2 3 5 2 8 7 8 2 4 2 8 res = 5 2 3 7 4 9 2 3 8 2 3 5 2 8 8 7 4 2 8 2 res = 5 2 3 7 4 9 2 3 8 2 3 5 2 8 8 7 4 2 2 8 res = 5 2 3 7 4 9 2 3 8 2 3 5 2 8 8 7 2 4 8 2 res = 5 2 3 7 4 9 2 3 8 2 3 5 2 8 8 7 2 4 2 8 res = 5 2 3 7 4 9 2 3 8 2 5 3 8 2 7 8 4 2 8 2 res = 5 2 3 7 4 9 2 3 8 2 5 3 8 2 7 8 4 2 2 8 res = 5 2 3 7 4 9 2 3 8 2 5 3 8 2 7 8 2 4 8 2 res = 5 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 8 2 4 8 2 res = 5 2 3 7 4 9 3 2 8 2 3 5 8 2 7 8 2 4 2 8 res = 5 2 3 7 4 9 3 2 8 2 3 5 8 2 8 7 4 2 8 2 res = 5 2 3 7 4 9 3 2 8 2 3 5 8 2 8 7 4 2 2 8 res = 5 2 3 7 4 9 3 2 8 2 3 5 8 2 8 7 2 4 8 2 res = 5 2 3 7 4 9 3 2 8 2 3 5 8 2 8 7 2 4 2 ...

2   Pass
list = [0 8 4 8 2 0 8 0 5 7 7 2 1 6 2 6 2 7 0 2]; y_correct = [0 1 0 1 1 1 1 0 1 1]; assert(isequal(findBestDominoeOrientation(list),y_correct))

res = 0 8 4 8 2 0 8 0 5 7 7 2 1 6 2 6 2 7 0 2 res = 0 8 4 8 2 0 8 0 5 7 7 2 1 6 2 6 2 7 2 0 res = 0 8 4 8 2 0 8 0 5 7 7 2 1 6 2 6 7 2 0 2 res = 0 8 4 8 2 0 8 0 5 7 7 2 1 6 2 6 7 2 2 0 res = 0 8 4 8 2 0 8 0 5 7 7 2 1 6 6 2 2 7 0 2 res = 0 8 4 8 2 0 8 0 5 7 7 2 1 6 6 2 2 7 2 0 res = 0 8 4 8 2 0 8 0 5 7 7 2 1 6 6 2 7 2 0 2 res = 0 8 4 8 2 0 8 0 5 7 7 2 1 6 6 2 7 2 2 0 res = 0 8 4 8 2 0 8 0 5 7 7 2 6 1 2 6 2 7 0 2 res = 0 8 4 8 2 0 8 0 5 7 7 2 6 1 2 6 2 7 2 0 res = 0 8 4 8 2 0 8 0 5 7 7 2 6 1 2 6 7 2 0 2 res = 0 8 4 8 2 0 8 0 5 7 7 2 6 1 2 6 7 2 2 0 res = 0 8 4 8 2 0 8 0 5 7 7 2 6 1 6 2 2 7 0 2 res = 0 8 4 8 2 0 8 0 5 7 7 2 6 1 6 2 2 7 2 0 res = 0 8 4 8 2 0 8 0 5 7 7 2 6 1 6 2 7 2 0 2 res = 0 8 4 8 2 0 8 0 5 7 7 2 6 1 6 2 7 2 2 0 res = 0 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 2 7 2 2 0 res = 0 8 4 8 2 0 0 8 5 7 7 2 1 6 2 6 2 7 0 2 res = 0 8 4 8 2 0 0 8 5 7 7 2 1 6 2 6 2 7 2 0 res = 0 8 4 8 2 0 0 8 5 7 7 2 1 6 2 6 7 2 0 2 res = 0 8 4 8 2 0 0 8 5 7 7 2 1 6 2 6 7 2 2 0 res = 0 8 4 8 2 0 0 8 5 7 7 2 1 6 6 2 2 7 0 2 res = 0 8 4 8 2 0 0 8 5 7 7 2 1 6 6 2 2 7 2 0 res = 0 8 4 8 2 0 0 8 5 7 7 2 1 6 6 2 7 2 0 2 res = 0 8 4 8 2 0 0 8 5 7 7 2 1 6 6 2 7 2 2 ...

3   Pass
list = [7 5 3 1 5 1 6 5 4 8 2 6 5 1 1 3 5 9 9 2 0 7 1 7]; y_correct = [0 0 1 1 1 0 0 0 0 0 0 1]; assert(isequal(findBestDominoeOrientation(list),y_correct))

res = 7 5 3 1 5 1 6 5 4 8 2 6 5 1 1 3 5 9 9 2 0 7 1 7 res = 7 5 3 1 5 1 6 5 4 8 2 6 5 1 1 3 5 9 9 2 0 7 7 1 res = 7 5 3 1 5 1 6 5 4 8 2 6 5 1 1 3 5 9 9 2 7 0 1 7 res = 7 5 3 1 5 1 6 5 4 8 2 6 5 1 1 3 5 9 9 2 7 0 7 1 res = 7 5 3 1 5 1 6 5 4 8 2 6 5 1 1 3 5 9 2 9 0 7 1 7 res = 7 5 3 1 5 1 6 5 4 8 2 6 5 1 1 3 5 9 2 9 0 7 7 1 res = 7 5 3 1 5 1 6 5 4 8 2 6 5 1 1 3 5 9 2 9 7 0 1 7 res = 7 5 3 1 5 1 6 5 4 8 2 6 5 1 1 3 5 9 2 9 7 0 7 1 res = 7 5 3 1 5 1 6 5 4 8 2 6 5 1 1 3 9 5 9 2 0 7 1 7 res = 7 5 3 1 5 1 6 5 4 8 2 6 5 1 1 3 9 5 9 2 0 7 7 1 res = 7 5 3 1 5 1 6 5 4 8 2 6 5 1 1 3 9 5 9 2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 res = 7 5 3 1 5 1 6 5 4 8 2 6 1 5 3 1 5 9 9 2 7 0 7 1 res = 7 5 3 1 5 1 6 5 4 8 2 6 1 5 3 1 5 9 2 9 0 7 1 7 res = 7 5 3 1 5 1 6 5 4 8 2 6 1 5 3 1 5 9 2 9 0 7 7 1 res = 7 5 3 1 5 1 6 5 4 8 2 6 1 5 3 1 5 9 2 9 7 0 1 7 res = 7 5 3 1 5 1 6 5 4 8 2 6 1 5 3 1 5 9 2 9 7 0 7 1 res = 7 5 3 1 5 1 6 5 4 8 2 6 1 5 3 1 9 5 9 2 0 7 1 7 res = 7 5 3 1 5 1 6 5 4 8 2 6 1 5 3 1 9 5 9 2 0 7 7 1 res = 7 5 3 1 5 1 6 5 4 8 2 6 1 5 3 1 9 5 9 2 7 0 1 7 res = 7 5 3 1 5 1 6 5 4 8 2 6 1 5 3 1 9 5 9 2 7 0 7 1 res = 7 5 3 1 5 1 6 5 4 8 2 6 1 5 ...

4   Pass
list = [0 4 0 3 8 2 2 5]; y_correct = [1 0 1 1]; assert(isequal(findBestDominoeOrientation(list),y_correct))

res = 0 4 0 3 8 2 2 5 res = 0 4 0 3 8 2 5 2 res = 0 4 0 3 2 8 2 5 res = 0 4 0 3 2 8 5 2 res = 0 4 3 0 8 2 2 5 res = 0 4 3 0 8 2 5 2 res = 0 4 3 0 2 8 2 5 res = 0 4 3 0 2 8 5 2 res = 4 0 0 3 8 2 2 5 res = 4 0 0 3 8 2 5 2 res = 4 0 0 3 2 8 2 5 res = 4 0 0 3 2 8 5 2 res = 4 0 3 0 8 2 2 5 res = 4 0 3 0 8 2 5 2 res = 4 0 3 0 2 8 2 5 res = 4 0 3 0 2 8 5 2