Cody

# Problem 2848. Digital Neighbourhood

Solution 561181

Submitted on 20 Jan 2015 by goc3
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
%% x = 132; y_correct = 123; assert(isequal(find_neighbour(x),y_correct))

v = 1 3 2

2   Pass
%% x = 182; y_correct = 218; assert(isequal(find_neighbour(x),y_correct))

v = 1 8 2

3   Pass
%% x = 172; y_correct = [127; 217]; % there are two such numbers, one of them is enough, but you can return both y = sort(find_neighbour(x)); fprintf('%d founded.\n',y) y = y(:); assert(any(y_correct==y))

v = 1 7 2 217 founded.

4   Pass
%% x = 1; y_correct = 10; assert(isequal(find_neighbour(x),y_correct))

v = 1 v = 1 0

5   Pass
%% x = 10; y_correct = 1; assert(isequal(find_neighbour(x),y_correct))

v = 1 0

6   Pass
%% x = 100; y_correct = 10; assert(isequal(find_neighbour(x),y_correct))

v = 1 0 0 v = 1 0 0 0

7   Pass
%% x = 99; y_correct = 909; assert(isequal(find_neighbour(x),y_correct))

v = 9 9 v = 9 9 0

8   Pass
%% x = 199; y_correct = 919; assert(isequal(find_neighbour(x),y_correct))

v = 1 9 9 v = 1 9 9 0

9   Pass
%% x = 1099; y_correct = 991; assert(isequal(find_neighbour(x),y_correct))

v = 1 0 9 9 v = 1 0 9 9 0

10   Pass
%% x = 123455; y_correct = 123545; assert(isequal(find_neighbour(x),y_correct))

v = 1 2 3 4 5 5

11   Pass
%% x = 56565656; y_correct = 56565665; assert(isequal(find_neighbour(x),y_correct))

v = 5 6 5 6 5 6 5 6

12   Pass
%% x = 8761199; y_correct = 8761919; assert(isequal(find_neighbour(x),y_correct))

v = 8 7 6 1 1 9 9

13   Pass
%% x = 820199; y_correct = 819920; assert(isequal(find_neighbour(x),y_correct))

v = 8 2 0 1 9 9

14   Pass
%% x = 991; y_correct = 919; assert(isequal(find_neighbour(x),y_correct))

v = 9 9 1 v = 9 9 1 0

15   Pass
%% x = 911; y_correct = 1019; assert(isequal(find_neighbour(x),y_correct))

v = 9 1 1 v = 9 1 1 0

16   Pass
%% x = 7001; y_correct = 7010; assert(isequal(find_neighbour(x),y_correct))

v = 7 0 0 1 v = 7 0 0 1 0

17   Pass
%% x = 1192999; y_correct = 1199299; assert(isequal(find_neighbour(x),y_correct))

v = 1 1 9 2 9 9 9

18   Pass
%% x = 8713222; y_correct = 8712322; assert(isequal(find_neighbour(x),y_correct))

v = 8 7 1 3 2 2 2