Statistics

Problem Statement for "ReverseSums"

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

  1. 1325

    Returns: 6556

    The example from the problem statement. 1325 + 5231 = 6556.

  2. 100

    Returns: 101

    100 + 001 = 101

  3. 89437

    Returns: 162935

    89437 + 73498 = 162935

  4. 1

    Returns: 2

  5. 29828

    Returns: 112720

  6. 10001

    Returns: 20002

  7. 10101

    Returns: 20202

  8. 99999

    Returns: 199998

  9. 11

    Returns: 22

  10. 5

    Returns: 10

  11. 20001

    Returns: 30003

  12. 54321

    Returns: 66666

  13. 98989

    Returns: 197978

  14. 93958

    Returns: 179897

  15. 2342

    Returns: 4774

  16. 119

    Returns: 1030

  17. 222

    Returns: 444

  18. 45

    Returns: 99

  19. 88

    Returns: 176

  20. 76

    Returns: 143

  21. 48101

    Returns: 58285

  22. 4112

    Returns: 6226

  23. 89890

    Returns: 99788

  24. 76067

    Returns: 152134

  25. 10042

    Returns: 34043

  26. 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!!

  27. 10

    Returns: 11


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: