Cody

Solution 1539200

Submitted on 24 May 2018 by J. S. Kowontan
  • Size: 30
  • This is the leading solution.
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))

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

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

217 founded.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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