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
1325
Returns: 6556
The example from the problem statement. 1325 + 5231 = 6556.
100
Returns: 101
100 + 001 = 101
89437
Returns: 162935
89437 + 73498 = 162935
1
Returns: 2
29828
Returns: 112720
10001
Returns: 20002
10101
Returns: 20202
99999
Returns: 199998
11
Returns: 22
5
Returns: 10
20001
Returns: 30003
54321
Returns: 66666
98989
Returns: 197978
93958
Returns: 179897
2342
Returns: 4774
119
Returns: 1030
222
Returns: 444
45
Returns: 99
88
Returns: 176
76
Returns: 143
48101
Returns: 58285
4112
Returns: 6226
89890
Returns: 99788
76067
Returns: 152134
10042
Returns: 34043
41011
Returns: 52025
How you would get the others right and this one wrong, I have no idea. But here it is. The grand challenge: 41011!!
10
Returns: 11