Cody

# Problem 74. Balanced number

Solution 35409

Submitted on 9 Feb 2012 by Mike
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))

sn = 13722 dd = 5 [Warning: Integer operands are required for colon operator when used as index] [> In isBalanced at 5 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14] [Warning: Integer operands are required for colon operator when used as index] [> In isBalanced at 5 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14]

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

sn = 23567414 dd = 8

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

sn = 20567410 dd = 8

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

sn = 1 dd = 1 [Warning: Integer operands are required for colon operator when used as index] [> In isBalanced at 5 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14] [Warning: Integer operands are required for colon operator when used as index] [> In isBalanced at 5 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14]

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

sn = 11111111 dd = 8

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

sn = 12345678 dd = 8

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

sn = 12333 dd = 5 [Warning: Integer operands are required for colon operator when used as index] [> In isBalanced at 5 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14] [Warning: Integer operands are required for colon operator when used as index] [> In isBalanced at 5 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14]

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

sn = 9898 dd = 4

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

sn = 469200 dd = 6

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

sn = 57666 dd = 5 [Warning: Integer operands are required for colon operator when used as index] [> In isBalanced at 5 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14] [Warning: Integer operands are required for colon operator when used as index] [> In isBalanced at 5 In verifyCode>evaluateCode at 227 In verifyCode at 40 In fevalJSON at 14]

### Community Treasure Hunt

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

Start Hunting!