Cody

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

Solution 1788261

Submitted on 15 Apr 2019 by danteliujie
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)')) )

ans = 1 2 2 1 3 1 2 2 1 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isNumPalindrome (line 12) In ScoringEngineTestPoint1 (line 3) In solutionTest (line 3)]

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

ans = 1 2 2 1 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isNumPalindrome (line 12) In ScoringEngineTestPoint2 (line 3) In solutionTest (line 5)]

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

ans = 1 2 3 4 5 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isNumPalindrome (line 12) In ScoringEngineTestPoint3 (line 3) In solutionTest (line 7)]

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

ans = 9 8 4 9 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isNumPalindrome (line 12) In ScoringEngineTestPoint4 (line 3) In solutionTest (line 9)]