Cody

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

Solution 14683

Submitted on 30 Jan 2012 by Mythreya
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)')) )

``` last = 1 first = 1 y = 1 last = 2 first = 2 y = 1 last = 2 first = 2 y = 1 last = 1 first = 1 y = 1 last = 3 first = 3 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)')) )

``` last = 1 first = 1 y = 1 last = 2 first = 2 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)')) )

``` last = 1 first = 5 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)')) )

``` last = 9 first = 9 y = 1 last = 8 first = 4 y = 0 ```