Cody

# Problem 172. Test if a Number is a Palindrome without using any String Operations

Solution 1988407

Submitted on 24 Oct 2019 by Asif Newaz
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 = 122131221; y_correct = true; assert( isequal(isNumPalindrome(x),y_correct) && isempty(regexp(evalc('type isNumPalindrome'),'(str|printf|eval|flip|dec2base)')) )

a = 1 b = 1 x = 22131221 x = 2213122 a = 2 b = 2 x = 213122 x = 21312 a = 2 b = 2 x = 1312 x = 131 a = 1 b = 1 x = 31 x = 3

2   Pass
x = 1221; y_correct = true; assert( isequal(isNumPalindrome(x),y_correct) && isempty(regexp(evalc('type isNumPalindrome'),'(str|printf|eval|flip|dec2base)')) )

a = 1 b = 1 x = 221 x = 22 a = 2 b = 2 x = 2 x = 0

3   Pass
x = 12345; y_correct = false; assert( isequal(isNumPalindrome(x),y_correct) && isempty(regexp(evalc('type isNumPalindrome'),'(str|printf|eval|flip|dec2base)')) )

a = 1 b = 5 x = 2345 x = 234

4   Pass
x = 9849; y_correct = false; assert( isequal(isNumPalindrome(x),y_correct) && isempty(regexp(evalc('type isNumPalindrome'),'(str|printf|eval|flip|dec2base)')) )

a = 9 b = 9 x = 849 x = 84 a = 8 b = 4 x = 4 x = 0

### Community Treasure Hunt

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

Start Hunting!