Cody

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

Solution 2024379

Submitted on 16 Nov 2019 by Doan Quang Manh
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)')) )

m = 1 r = 1 a = 12213122 m = 2 r = 12 a = 1221312 m = 2 r = 122 a = 122131 m = 1 r = 1221 a = 12213 m = 3 r = 12213 a = 1221 m = 1 r = 122131 a = 122 m = 2 r = 1221312 a = 12 m = 2 r = 12213122 a = 1 m = 1 r = 122131221 a = 0 y = 1

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

m = 1 r = 1 a = 122 m = 2 r = 12 a = 12 m = 2 r = 122 a = 1 m = 1 r = 1221 a = 0 y = 1

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

m = 5 r = 5 a = 1234 m = 4 r = 54 a = 123 m = 3 r = 543 a = 12 m = 2 r = 5432 a = 1 m = 1 r = 54321 a = 0 y = 0

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

m = 9 r = 9 a = 984 m = 4 r = 94 a = 98 m = 8 r = 948 a = 9 m = 9 r = 9489 a = 0 y = 0