Cody

# Problem 42822. balance vector

Solution 1698267

Submitted on 21 Dec 2018 by Martin C.
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
x = [1,1]; y_correct = true; assert(Balance(x)==y_correct);

p = 1 1 1 1 y = logical 1

2   Pass
x = [1,7]; y_correct = false; assert(Balance(x)==y_correct);

p = 7 1 1 7 y = logical 0

3   Pass
x = [2,3,5]; y_correct = true; assert(Balance(x)==y_correct);

p = 5 3 2 5 2 3 3 5 2 3 2 5 2 5 3 2 3 5 y = logical 1

4   Pass
x = 1:4; y_correct = true; assert(Balance(x)==y_correct);

p = 4 3 2 1 4 3 1 2 4 2 3 1 4 2 1 3 4 1 3 2 4 1 2 3 3 4 2 1 3 4 1 2 3 2 4 1 3 2 1 4 3 1 4 2 3 1 2 4 2 4 3 1 2 4 1 3 2 3 4 1 2 3 1 4 2 1 4 3 2 1 3 4 1 4 3 2 1 4 2 3 1 3 4 2 1 3 2 4 1 2 4 3 1 2 3 4 y = logical 1

5   Pass
x = 1:5; y_correct = false; assert(Balance(x)==y_correct);

p = 5 4 3 2 1 5 4 3 1 2 5 4 2 3 1 5 4 2 1 3 5 4 1 3 2 5 4 1 2 3 5 3 4 2 1 5 3 4 1 2 5 3 2 4 1 5 3 2 1 4 5 3 1 4 2 5 3 1 2 4 5 2 4 3 1 5 2 4 1 3 5 2 3 4 1 5 2 3 1 4 5 2 1 4 3 5 2 1 3 4 5 1 4 3 2 5 1 4 2 3 5 1 3 4 2 5 1 3 2 4 5 1 2 4 3 5 1 2 3 4 4 5 3 2 1 4 5 3 1 2 4 5 2 3 1 4 5 2 1 3 4 5 1 3 2 4 5 1 2 3 4 3 5 2 1 4 3 5 1 2 4 3 2 5 1 4 3 2 1 5 4 3 1 5 2 4 3 1 2 5 4 2 5 3 1 4 2 5 1 3 4 2 3 5 1 4 2 3 1 5 4 2 1 5 3 4 2 1 3 5 4 1 5 3 2 4 1 5 2 3 4 1 3 5 2 4 1 3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