Cody

Solution 1227286

Submitted on 8 Jul 2017 by Salvatore Lacava
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))

y = [] num = 5 y = 2 n = 1372 y = 2 2 n = 137 y = 2 2 7 n = 13 y = 2 2 7 3 n = 1 y = 2 2 7 3 1 n = 0 [Warning: Integer operands are required for colon operator when used as index] [Warning: Integer operands are required for colon operator when used as index] b = 3 1 sumA = 4 sumB = 4 tf = logical 1

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

y = [] num = 8 y = 4 n = 2356741 y = 4 1 n = 235674 y = 4 1 4 n = 23567 y = 4 1 4 7 n = 2356 y = 4 1 4 7 6 n = 235 y = 4 1 4 7 6 5 n = 23 y = 4 1 4 7 6 5 3 n = 2 y = 4 1 4 7 6 5 3 2 n = 0 b = 6 5 3 2 sumA = 16 sumB = 16 tf = logical 1

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

y = [] num = 8 y = 0 n = 2056741 y = 0 1 n = 205674 y = 0 1 4 n = 20567 y = 0 1 4 7 n = 2056 y = 0 1 4 7 6 n = 205 y = 0 1 4 7 6 5 n = 20 y = 0 1 4 7 6 5 0 n = 2 y = 0 1 4 7 6 5 0 2 n = 0 b = 6 5 0 2 sumA = 12 sumB = 13 tf = logical 0

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

y = [] num = 1 y = 1 n = 0 [Warning: Integer operands are required for colon operator when used as index] [Warning: Integer operands are required for colon operator when used as index] b = 1×0 empty double row vector sumA = 0 sumB = 0 tf = logical 1

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

y = [] num = 8 y = 1 n = 1111111 y = 1 1 n = 111111 y = 1 1 1 n = 11111 y = 1 1 1 1 n = 1111 y = 1 1 1 1 1 n = 111 y = 1 1 1 1 1 1 n = 11 y = 1 1 1 1 1 1 1 n = 1 y = 1 1 1 1 1 1 1 1 n = 0 b = 1 1 1 1 sumA = 4 sumB = 4 tf = logical 1

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

y = [] num = 8 y = 8 n = 1234567 y = 8 7 n = 123456 y = 8 7 6 n = 12345 y = 8 7 6 5 n = 1234 y = 8 7 6 5 4 n = 123 y = 8 7 6 5 4 3 n = 12 y = 8 7 6 5 4 3 2 n = 1 y = 8 7 6 5 4 3 2 1 n = 0 b = 4 3 2 1 sumA = 26 sumB = 10 tf = logical 0

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

y = [] num = 5 y = 3 n = 1233 y = 3 3 n = 123 y = 3 3 3 n = 12 y = 3 3 3 2 n = 1 y = 3 3 3 2 1 n = 0 [Warning: Integer operands are required for colon operator when used as index] [Warning: Integer operands are required for colon operator when used as index] b = 2 1 sumA = 6 sumB = 3 tf = logical 0

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

y = [] num = 4 y = 8 n = 989 y = 8 9 n = 98 y = 8 9 8 n = 9 y = 8 9 8 9 n = 0 b = 8 9 sumA = 17 sumB = 17 tf = logical 1

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

y = [] num = 6 y = 0 n = 46920 y = 0 0 n = 4692 y = 0 0 2 n = 469 y = 0 0 2 9 n = 46 y = 0 0 2 9 6 n = 4 y = 0 0 2 9 6 4 n = 0 b = 9 6 4 sumA = 2 sumB = 19 tf = logical 0

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

y = [] num = 5 y = 6 n = 5766 y = 6 6 n = 576 y = 6 6 6 n = 57 y = 6 6 6 7 n = 5 y = 6 6 6 7 5 n = 0 [Warning: Integer operands are required for colon operator when used as index] [Warning: Integer operands are required for colon operator when used as index] b = 7 5 sumA = 12 sumB = 12 tf = logical 1