Cody

Solution 1662042

Submitted on 30 Oct 2018 by Valentin Neis
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
n = 13722; assert(isequal(isBalanced(n),true))

v1 = 4 xarray2 = 0 0 0 2 xarray2 = 0 0 0 2 2 v2 = 4

2   Pass
n = 23567414; assert(isequal(isBalanced(n),true))

v1 = 16 xarray2 = 0 0 0 0 7 xarray2 = 0 0 0 0 7 4 xarray2 = 0 0 0 0 7 4 1 xarray2 = 0 0 0 0 7 4 1 4 v2 = 16

3   Pass
n = 20567410; assert(isequal(isBalanced(n),false))

v1 = 13 xarray2 = 0 0 0 0 7 xarray2 = 0 0 0 0 7 4 xarray2 = 0 0 0 0 7 4 1 xarray2 = 0 0 0 0 7 4 1 0 v2 = 12

4   Pass
n = 1; assert(isequal(isBalanced(n),true))

tf = logical 1

5   Pass
n = 11111111; assert(isequal(isBalanced(n),true))

v1 = 4 xarray2 = 0 0 0 0 1 xarray2 = 0 0 0 0 1 1 xarray2 = 0 0 0 0 1 1 1 xarray2 = 0 0 0 0 1 1 1 1 v2 = 4

6   Pass
n = 12345678; assert(isequal(isBalanced(n),false))

v1 = 10 xarray2 = 0 0 0 0 5 xarray2 = 0 0 0 0 5 6 xarray2 = 0 0 0 0 5 6 7 xarray2 = 0 0 0 0 5 6 7 8 v2 = 26

7   Pass
n = 12333; assert(isequal(isBalanced(n),false))

v1 = 3 xarray2 = 0 0 0 3 xarray2 = 0 0 0 3 3 v2 = 6

8   Pass
n = 9898; assert(isequal(isBalanced(n),true))

v1 = 17 xarray2 = 0 0 9 xarray2 = 0 0 9 8 v2 = 17

9   Pass
n = 469200; assert(isequal(isBalanced(n),false))

v1 = 19 xarray2 = 0 0 0 2 xarray2 = 0 0 0 2 0 xarray2 = 0 0 0 2 0 0 v2 = 2

10   Pass
n = 57666; assert(isequal(isBalanced(n),true))

v1 = 12 xarray2 = 0 0 0 6 xarray2 = 0 0 0 6 6 v2 = 12