Cody

Problem 45. Make a Palindrome Number

Solution 3206981

Submitted on 14 Oct 2020 by 元清 谭
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
a = 124; b = 545; assert(isequal(find_palindrome(a),b))

b = 0 0 0 5 b = 0 0 4 5 b = 0 5 4 5 cen1 = 5 cen1 = 45 cen1 = 545

2   Pass
a = 150; b = 303; assert(isequal(find_palindrome(a),b))

b = 0 0 0 1 b = 0 0 10 1 b = 0 1 0 1 b = 0 2 0 1 b = 0 0 0 3 b = 0 0 0 3 b = 0 3 0 3 cen1 = 3 cen1 = 3 cen1 = 303

3   Pass
a = 291; b = 6996; assert(isequal(find_palindrome(a),b))

b = 0 0 0 3 b = 0 0 18 3 b = 0 1 8 3 b = 0 4 8 3 b = 0 0 0 7 b = 0 0 16 7 b = 0 1 6 7 b = 0 8 6 7 b = 0 0 0 15 b = 0 0 1 5 b = 0 0 13 5 b = 0 1 3 5 b = 0 16 3 5 b = 1 6 3 5 b = 0 0 0 0 6 b = 0 0 0 9 6 b = 0 0 9 9 6 b = 0 6 9 9 6 cen1 = 6 cen1 = 96 cen1 = 996 cen1 = 6996

4   Pass
a = 178; b = 15851; assert(isequal(find_palindrome(a),b))

b = 0 0 0 9 b = 0 0 14 9 b = 0 1 4 9 b = 0 10 4 9 b = 1 0 4 9 b = 0 0 0 0 10 b = 0 0 0 1 0 b = 0 0 0 5 0 b = 0 0 4 5 0 b = 0 10 4 5 0 b = 1 0 4 5 0 b = 0 0 0 0 0 1 b = 0 0 0 0 5 1 b = 0 0 0 8 5 1 b = 0 0 5 8 5 1 b = 0 1 5 8 5 1 cen1 = 1 cen1 = 51 cen1 = 851 cen1 = 5851 cen1 = 15851

Suggested Problems

More from this Author95

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!