Cody

# Problem 74. Balanced number

Solution 1753539

Submitted on 18 Mar 2019 by Rajpurohith Urmila
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))

b = 1 3 7 2 2 x = 0 y = 0 a = 5 m = 3 x = 1 x = 4 y = 2 y = 4 tf = logical 1

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

b = 2 3 5 6 7 4 1 4 x = 0 y = 0 a = 8 m = 4 x = 2 x = 5 x = 10 x = 16 y = 7 y = 11 y = 12 y = 16 tf = logical 1

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

b = 2 0 5 6 7 4 1 0 x = 0 y = 0 a = 8 m = 4 x = 2 x = 2 x = 7 x = 13 y = 7 y = 11 y = 12 y = 12 tf = logical 0

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

b = 1 x = 0 y = 0 a = 1 m = 1 tf = logical 1

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

b = 1 1 1 1 1 1 1 1 x = 0 y = 0 a = 8 m = 4 x = 1 x = 2 x = 3 x = 4 y = 1 y = 2 y = 3 y = 4 tf = logical 1

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

b = 1 2 3 4 5 6 7 8 x = 0 y = 0 a = 8 m = 4 x = 1 x = 3 x = 6 x = 10 y = 5 y = 11 y = 18 y = 26 tf = logical 0

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

b = 1 2 3 3 3 x = 0 y = 0 a = 5 m = 3 x = 1 x = 3 y = 3 y = 6 tf = logical 0

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

b = 9 8 9 8 x = 0 y = 0 a = 4 m = 2 x = 9 x = 17 y = 9 y = 17 tf = logical 1

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

b = 4 6 9 2 0 0 x = 0 y = 0 a = 6 m = 3 x = 4 x = 10 x = 19 y = 2 y = 2 y = 2 tf = logical 0

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

b = 5 7 6 6 6 x = 0 y = 0 a = 5 m = 3 x = 5 x = 12 y = 6 y = 12 tf = logical 1