Cody

Solution 589319

Submitted on 1 Mar 2015 by Chris McComb
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))

first = 1 last = 2 first = 4 last = 4

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

first = 2 last = 4 first = 5 last = 5 first = 10 last = 9 first = 16 last = 16

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

first = 2 last = 0 first = 2 last = 1 first = 7 last = 5 first = 13 last = 12

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

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

first = 1 last = 1 first = 2 last = 2 first = 3 last = 3 first = 4 last = 4

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

first = 1 last = 8 first = 3 last = 15 first = 6 last = 21 first = 10 last = 26

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

first = 1 last = 3 first = 3 last = 6

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

first = 9 last = 8 first = 17 last = 17

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

first = 4 last = 0 first = 10 last = 0 first = 19 last = 2

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

first = 5 last = 6 first = 12 last = 12

Suggested Problems

More from this Author95