Cody

Solution 1057320

Submitted on 20 Nov 2016 by shahin rmz
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))

n = 13722 f = 2 s1 = 1 s1 = 1 s2 = 0 0 0 2 s3 = 2 s2 = 0 0 0 2 2 s3 = 4 tf = logical 0 s1 = 1 3 s1 = 4 s2 = 0 0 0 2 2 s3 = 4 s2 = 0 0 0 2 2 s3 = 4 tf = logical 1

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

n = 23567414 f = 4 s1 = 2 s1 = 2 s2 = 0 0 0 0 7 s3 = 7 s2 = 0 0 0 0 7 4 s3 = 11 s2 = 0 0 0 0 7 4 1 s3 = 12 s2 = 0 0 0 0 7 4 1 4 s3 = 16 tf = logical 0 s1 = 2 3 s1 = 5 s2 = 0 0 0 0 7 4 1 4 s3 = 16 s2 = 0 0 0 0 7 4 1 4 s3 = 16 s2 = 0 0 0 0 7 4 1 4 s3 = 16 s2 = 0 0 0 0 7 4 1 4 s3 = 16 tf = logical 0 s1 = 5 0 5 s1 = 10 s2 = 0 0 0 0 7 4 1 4 s3 = 16 s2 = 0 0 0 0 7 4 1 4 s3 = 16 s2 = 0 0 0 0 7 4 1 4 s3 = 16 s2 = 0 0 0 0 7 4 1 4 s3 = 16 tf = logical 0 s1 = 10 0 0 6 s1 = 16 s2 = 0 0 0 0 7 4 1 4 s3 = 16 s2 = 0 0 0 0 7 4 1 4 s3 = 16 s2 = 0 0 0 0 7 4 1 4 s3 = 16 s2 = 0 0 0 0 7 4 1 4 s3 = 16 tf = logical 1

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

n = 20567410 f = 4 s1 = 2 s1 = 2 s2 = 0 0 0 0 7 s3 = 7 s2 = 0 0 0 0 7 4 s3 = 11 s2 = 0 0 0 0 7 4 1 s3 = 12 s2 = 0 0 0 0 7 4 1 0 s3 = 12 tf = logical 0 s1 = 2 0 s1 = 2 s2 = 0 0 0 0 7 4 1 0 s3 = 12 s2 = 0 0 0 0 7 4 1 0 s3 = 12 s2 = 0 0 0 0 7 4 1 0 s3 = 12 s2 = 0 0 0 0 7 4 1 0 s3 = 12 tf = logical 0 s1 = 2 0 5 s1 = 7 s2 = 0 0 0 0 7 4 1 0 s3 = 12 s2 = 0 0 0 0 7 4 1 0 s3 = 12 s2 = 0 0 0 0 7 4 1 0 s3 = 12 s2 = 0 0 0 0 7 4 1 0 s3 = 12 tf = logical 0 s1 = 7 0 0 6 s1 = 13 s2 = 0 0 0 0 7 4 1 0 s3 = 12 s2 = 0 0 0 0 7 4 1 0 s3 = 12 s2 = 0 0 0 0 7 4 1 0 s3 = 12 s2 = 0 0 0 0 7 4 1 0 s3 = 12 tf = logical 0

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

tf = logical 1

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

n = 11111111 f = 4 s1 = 1 s1 = 1 s2 = 0 0 0 0 1 s3 = 1 s2 = 0 0 0 0 1 1 s3 = 2 s2 = 0 0 0 0 1 1 1 s3 = 3 s2 = 0 0 0 0 1 1 1 1 s3 = 4 tf = logical 0 s1 = 1 1 s1 = 2 s2 = 0 0 0 0 1 1 1 1 s3 = 4 s2 = 0 0 0 0 1 1 1 1 s3 = 4 s2 = 0 0 0 0 1 1 1 1 s3 = 4 s2 = 0 0 0 0 1 1 1 1 s3 = 4 tf = logical 0 s1 = 2 0 1 s1 = 3 s2 = 0 0 0 0 1 1 1 1 s3 = 4 s2 = 0 0 0 0 1 1 1 1 s3 = 4 s2 = 0 0 0 0 1 1 1 1 s3 = 4 s2 = 0 0 0 0 1 1 1 1 s3 = 4 tf = logical 0 s1 = 3 0 0 1 s1 = 4 s2 = 0 0 0 0 1 1 1 1 s3 = 4 s2 = 0 0 0 0 1 1 1 1 s3 = 4 s2 = 0 0 0 0 1 1 1 1 s3 = 4 s2 = 0 0 0 0 1 1 1 1 s3 = 4 tf = logical 1

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

n = 12345678 f = 4 s1 = 1 s1 = 1 s2 = 0 0 0 0 5 s3 = 5 s2 = 0 0 0 0 5 6 s3 = 11 s2 = 0 0 0 0 5 6 7 s3 = 18 s2 = 0 0 0 0 5 6 7 8 s3 = 26 tf = logical 0 s1 = 1 2 s1 = 3 s2 = 0 0 0 0 5 6 7 8 s3 = 26 s2 = 0 0 0 0 5 6 7 8 s3 = 26 s2 = 0 0 0 0 5 6 7 8 s3 = 26 s2 = 0 0 0 0 5 6 7 8 s3 = 26 tf = logical 0 s1 = 3 0 3 s1 = 6 s2 = 0 0 0 0 5 6 7 8 s3 = 26 s2 = 0 0 0 0 5 6 7 8 s3 = 26 s2 = 0 0 0 0 5 6 7 8 s3 = 26 s2 = 0 0 0 0 5 6 7 8 s3 = 26 tf = logical 0 s1 = 6 0 0 4 s1 = 10 s2 = 0 0 0 0 5 6 7 8 s3 = 26 s2 = 0 0 0 0 5 6 7 8 s3 = 26 s2 = 0 0 0 0 5 6 7 8 s3 = 26 s2 = 0 0 0 0 5 6 7 8 s3 = 26 tf = logical 0

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

n = 12333 f = 2 s1 = 1 s1 = 1 s2 = 0 0 0 3 s3 = 3 s2 = 0 0 0 3 3 s3 = 6 tf = logical 0 s1 = 1 2 s1 = 3 s2 = 0 0 0 3 3 s3 = 6 s2 = 0 0 0 3 3 s3 = 6 tf = logical 0

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

n = 9898 f = 2 s1 = 9 s1 = 9 s2 = 0 0 9 s3 = 9 s2 = 0 0 9 8 s3 = 17 tf = logical 0 s1 = 9 8 s1 = 17 s2 = 0 0 9 8 s3 = 17 s2 = 0 0 9 8 s3 = 17 tf = logical 1

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

n = 469200 f = 3 s1 = 4 s1 = 4 s2 = 0 0 0 2 s3 = 2 s2 = 0 0 0 2 0 s3 = 2 s2 = 0 0 0 2 0 0 s3 = 2 tf = logical 0 s1 = 4 6 s1 = 10 s2 = 0 0 0 2 0 0 s3 = 2 s2 = 0 0 0 2 0 0 s3 = 2 s2 = 0 0 0 2 0 0 s3 = 2 tf = logical 0 s1 = 10 0 9 s1 = 19 s2 = 0 0 0 2 0 0 s3 = 2 s2 = 0 0 0 2 0 0 s3 = 2 s2 = 0 0 0 2 0 0 s3 = 2 tf = logical 0

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

n = 57666 f = 2 s1 = 5 s1 = 5 s2 = 0 0 0 6 s3 = 6 s2 = 0 0 0 6 6 s3 = 12 tf = logical 0 s1 = 5 7 s1 = 12 s2 = 0 0 0 6 6 s3 = 12 s2 = 0 0 0 6 6 s3 = 12 tf = logical 1