Cody

# Problem 74. Balanced number

Solution 2019559

Submitted on 14 Nov 2019 by Doan Quang Manh
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))

a1 = '13' a2 = '22' b1 = 1 b2 = 2 b1 = 4 b2 = 4 tf = logical 1

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

a1 = '2356' a2 = '7414' b1 = 2 b2 = 7 b1 = 5 b2 = 11 b1 = 10 b2 = 12 b1 = 16 b2 = 16 tf = logical 1

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

a1 = '2056' a2 = '7410' b1 = 2 b2 = 7 b1 = 2 b2 = 11 b1 = 7 b2 = 12 b1 = 13 b2 = 12 tf = logical 0

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

a1 = 1×0 empty char array a2 = 1×0 empty char array tf = logical 1

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

a1 = '1111' a2 = '1111' b1 = 1 b2 = 1 b1 = 2 b2 = 2 b1 = 3 b2 = 3 b1 = 4 b2 = 4 tf = logical 1

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

a1 = '1234' a2 = '5678' b1 = 1 b2 = 5 b1 = 3 b2 = 11 b1 = 6 b2 = 18 b1 = 10 b2 = 26 tf = logical 0

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

a1 = '12' a2 = '33' b1 = 1 b2 = 3 b1 = 3 b2 = 6 tf = logical 0

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

a1 = '98' a2 = '98' b1 = 9 b2 = 9 b1 = 17 b2 = 17 tf = logical 1

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

a1 = '469' a2 = '200' b1 = 4 b2 = 2 b1 = 10 b2 = 2 b1 = 19 b2 = 2 tf = logical 0

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

a1 = '57' a2 = '66' b1 = 5 b2 = 6 b1 = 12 b2 = 12 tf = logical 1