TopCoder problem "ReverseSums" used in TCHS SRM 29 (Division I Level One)



Problem Statement

    

To find the "reverse sum" of a number, we reverse the digits of the number and then add the original number to the reversed number. For example, to find the reverse sum of 1325, first reverse the digits to get 5231. Then, add the original number to get 5231+1325=6556.

Return the reverse sum of the given number N.

 

Definition

    
Class:ReverseSums
Method:getSum
Parameters:int
Returns:int
Method signature:int getSum(int N)
(be sure your method is public)
    
 

Constraints

-N will be between 1 and 99999, inclusive.
 

Examples

0)
    
1325
Returns: 6556
The example from the problem statement. 1325 + 5231 = 6556.
1)
    
100
Returns: 101
100 + 001 = 101
2)
    
89437
Returns: 162935
89437 + 73498 = 162935
3)
    
1
Returns: 2

Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=6557

Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=10653&pm=6557

Writer:

jmzero

Testers:

PabloGilberto , brett1479 , Olexiy

Problem categories:

Simple Math, String Manipulation