Problem
link
https://www.codechef.com/problems/INTROSRM
Difficulty Level : Very Easy
Initial Approach : It is a simple problem to reverse an integer. Here following algorithm will do just fine.
while(x != 0)
{
result = result * 10 + x % 10;
x = x / 10;
}
above algorithm takes the digits from the integer one-by-one and keep adding it from the start to reverse.
Final Approach : The above mentioned approach will work for all integers . Only tricky part in the question was to work on big integers. Use long long int for storing and manipulating integers in the range 8,446,744,073,709,551,615 ( pretty big ,eh! ).
Solution :
here