Cody

Problem 45. Make a Palindrome Number

Created by Cody Team in Cody Challenge

Some numbers like 323 are palindromes. Other numbers like 124 are not. But look what happens when we add that number to a reversed copy of itself.

    124
  + 421
   ----
    545

Let's try another.

    150
  + 051
   ----
    201

No, that didn't work, but what if we keep going?

    201
  + 102
   ----
    303

There, it became a palindrome again. Given a, return b = find_palindrome(a) such that b is the palindrome number that eventually results from repeated reversals and additions of a.

Example:

 Input  a = 150
 Output b is 303

Solution Stats

54.85% Correct | 45.15% Incorrect
Last solution submitted on Dec 13, 2018

Problem Comments

Solution Comments

Recent Solvers992

Tags

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!