Cody

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

Solution 2159533

Submitted on 14 Mar 2020
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   Fail
x = 122131221; y_correct = true; assert( isequal(isNumPalindrome(x),y_correct) && isempty(regexp(evalc('type isNumPalindrome'),'(str|printf|eval|flip|dec2base)')) )

Undefined function 'fliprl' for input arguments of type 'char'. Error in isNumPalindrome (line 2) y = fliprl(num2str(x)); Error in Test1 (line 3) assert( isequal(isNumPalindrome(x),y_correct) && isempty(regexp(evalc('type isNumPalindrome'),'(str|printf|eval|flip|dec2base)')) )

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

Undefined function 'fliprl' for input arguments of type 'char'. Error in isNumPalindrome (line 2) y = fliprl(num2str(x)); Error in Test2 (line 3) assert( isequal(isNumPalindrome(x),y_correct) && isempty(regexp(evalc('type isNumPalindrome'),'(str|printf|eval|flip|dec2base)')) )

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

Undefined function 'fliprl' for input arguments of type 'char'. Error in isNumPalindrome (line 2) y = fliprl(num2str(x)); Error in Test3 (line 3) assert( isequal(isNumPalindrome(x),y_correct) && isempty(regexp(evalc('type isNumPalindrome'),'(str|printf|eval|flip|dec2base)')) )

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

Undefined function 'fliprl' for input arguments of type 'char'. Error in isNumPalindrome (line 2) y = fliprl(num2str(x)); Error in Test4 (line 3) assert( isequal(isNumPalindrome(x),y_correct) && isempty(regexp(evalc('type isNumPalindrome'),'(str|printf|eval|flip|dec2base)')) )