Problem 172. Test if a Number is a Palindrome without using any String Operations
Description
Given an integer X, determine if it is a palindrome number. That is, X is equal to the X with the digits reversed (with no leading 0s). The twist is that your code cannot use any function or variable name that has either "str", "eval", "flip" or "printf" in it.
Example
X = 123454321; Y = true;
X = 1234; Y = false;
Solution Stats
Problem Comments
-
2 Comments
Freddy
on 22 Mar 2012
Nice expression for the usage test. Maybe one can add function "dec2base", cause the return type is a String.
Christian Schröder
on 15 Jul 2019
The problem description should mention that dec2base isn't allowed either.
Solution Comments
Show commentsProblem Recent Solvers231
Suggested Problems
-
Find the two most distant points
2834 Solvers
-
336 Solvers
-
383 Solvers
-
Calculate the area of a triangle between three points
2939 Solvers
-
Rounding off numbers to n decimals
4504 Solvers
More from this Author56
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!