Cody

# Problem 2848. Digital Neighbourhood

Solution 2783563

Submitted on 5 Aug 2020 by Mai Zhang
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))

ans = 123

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

ans = 218

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))

ans = 217 217 founded.

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

ans = 10

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

ans = 1

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

ans = 10

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

ans = 909

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

ans = 919

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

ans = 991

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

ans = 123545

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

ans = 56565665

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

ans = 8761919

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

ans = 819920

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

ans = 919

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

ans = 1019

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

ans = 7010

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

ans = 1199299

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

ans = 8712322