Cody

# Problem 74. Balanced number

Solution 1411213

Submitted on 9 Jan 2018 by Tan Shuwen is pig
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))

L = 5 flag = 2 j = 5 a = 1 b = 2 j = 4 a = 4 b = 4

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

L = 8 flag = 4 j = 8 a = 2 b = 4 j = 7 a = 5 b = 5 j = 6 a = 10 b = 9 j = 5 a = 16 b = 16

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

L = 8 flag = 4 j = 8 a = 2 b = 0 j = 7 a = 2 b = 1 j = 6 a = 7 b = 5 j = 5 a = 13 b = 12

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

L = 1 flag = 0

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

L = 8 flag = 4 j = 8 a = 1 b = 1 j = 7 a = 2 b = 2 j = 6 a = 3 b = 3 j = 5 a = 4 b = 4

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

L = 8 flag = 4 j = 8 a = 1 b = 8 j = 7 a = 3 b = 15 j = 6 a = 6 b = 21 j = 5 a = 10 b = 26

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

L = 5 flag = 2 j = 5 a = 1 b = 3 j = 4 a = 3 b = 6

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

L = 4 flag = 2 j = 4 a = 9 b = 8 j = 3 a = 17 b = 17

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

L = 6 flag = 3 j = 6 a = 4 b = 0 j = 5 a = 10 b = 0 j = 4 a = 19 b = 2

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

L = 5 flag = 2 j = 5 a = 5 b = 6 j = 4 a = 12 b = 12

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!