Cody

Solution 2643184

Submitted on 2 Jul 2020 by Manish Kumar
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))

x = 2 n = 1372 x = 2 2 n = 137 x = 2 2 7 n = 13 x = 2 2 7 3 n = 1 x = 2 2 7 3 1 n = 0 tf = logical 1

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

x = 4 n = 2356741 x = 4 1 n = 235674 x = 4 1 4 n = 23567 x = 4 1 4 7 n = 2356 x = 4 1 4 7 6 n = 235 x = 4 1 4 7 6 5 n = 23 x = 4 1 4 7 6 5 3 n = 2 x = 4 1 4 7 6 5 3 2 n = 0 tf = logical 1

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

x = 0 n = 2056741 x = 0 1 n = 205674 x = 0 1 4 n = 20567 x = 0 1 4 7 n = 2056 x = 0 1 4 7 6 n = 205 x = 0 1 4 7 6 5 n = 20 x = 0 1 4 7 6 5 0 n = 2 x = 0 1 4 7 6 5 0 2 n = 0

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

x = 1 n = 0 tf = logical 1

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

x = 1 n = 1111111 x = 1 1 n = 111111 x = 1 1 1 n = 11111 x = 1 1 1 1 n = 1111 x = 1 1 1 1 1 n = 111 x = 1 1 1 1 1 1 n = 11 x = 1 1 1 1 1 1 1 n = 1 x = 1 1 1 1 1 1 1 1 n = 0 tf = logical 1

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

x = 8 n = 1234567 x = 8 7 n = 123456 x = 8 7 6 n = 12345 x = 8 7 6 5 n = 1234 x = 8 7 6 5 4 n = 123 x = 8 7 6 5 4 3 n = 12 x = 8 7 6 5 4 3 2 n = 1 x = 8 7 6 5 4 3 2 1 n = 0

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

x = 3 n = 1233 x = 3 3 n = 123 x = 3 3 3 n = 12 x = 3 3 3 2 n = 1 x = 3 3 3 2 1 n = 0

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

x = 8 n = 989 x = 8 9 n = 98 x = 8 9 8 n = 9 x = 8 9 8 9 n = 0 tf = logical 1

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

x = 0 n = 46920 x = 0 0 n = 4692 x = 0 0 2 n = 469 x = 0 0 2 9 n = 46 x = 0 0 2 9 6 n = 4 x = 0 0 2 9 6 4 n = 0

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

x = 6 n = 5766 x = 6 6 n = 576 x = 6 6 6 n = 57 x = 6 6 6 7 n = 5 x = 6 6 6 7 5 n = 0 tf = logical 1

Suggested Problems

More from this Author95