Cody

# Problem 74. Balanced number

Solution 2962435

Submitted on 18 Sep 2020
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))

half_1 = 1 3 half_2 = 2 2 sum_1 = 4 sum_2 = 4

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

Output argument "tf" (and maybe others) not assigned during call to "isBalanced". Error in Test2 (line 2) assert(isequal(isBalanced(n),true))

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

Output argument "tf" (and maybe others) not assigned during call to "isBalanced". Error in Test3 (line 2) assert(isequal(isBalanced(n),false))

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

half_1 = 1×0 empty double row vector half_2 = 1×0 empty double row vector sum_1 = 0 sum_2 = 0

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

Output argument "tf" (and maybe others) not assigned during call to "isBalanced". Error in Test5 (line 2) assert(isequal(isBalanced(n),true))

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

Output argument "tf" (and maybe others) not assigned during call to "isBalanced". Error in Test6 (line 2) assert(isequal(isBalanced(n),false))

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

half_1 = 1 2 half_2 = 3 3 sum_1 = 3 sum_2 = 6

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

Output argument "tf" (and maybe others) not assigned during call to "isBalanced". Error in Test8 (line 2) assert(isequal(isBalanced(n),true))

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

Output argument "tf" (and maybe others) not assigned during call to "isBalanced". Error in Test9 (line 2) assert(isequal(isBalanced(n),false))

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

half_1 = 5 7 half_2 = 6 6 sum_1 = 12 sum_2 = 12

### Community Treasure Hunt

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

Start Hunting!