Check if a Number is a Palindrome Without Converting to String - MATLAB Cody - MATLAB Central

Problem 60853. Check if a Number is a Palindrome Without Converting to String

Difficulty:Rate
Write a function that checks if a given positive integer is a palindrome without converting the number to a string or using string functions.
A number is a palindrome if it reads the same forward and backward (e.g., 121, 12321, 454). Your function should return true if the number is a palindrome and false otherwise.
Constraints:
  • Input is a positive integer n (1 ≤ n ≤ 1e9)
  • Do not use string conversion (num2str, str2num, etc.)

Solution Stats

83.33% Correct | 16.67% Incorrect
Last Solution submitted on Jul 03, 2025

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers10

Suggested Problems

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!