You are given an integer 'n'. Your task is to perform a sequence of operations:
1)Reverse the digits of 'n'.
2)Square the reversed number.
3)From the squared result, extract only the even digits (0, 2, 4, 6, 8) and print them in the order they appear.
The first line of input contains a single integer 'n'.
Print the even digits found in the final squared number, separated by spaces.
If no even digits are found in the squared result, print nothing (an empty line).
When reversing the number, any leading zeros that result should be dropped. For example, reversing 120 results in 21, not 021.
The squared number can be large, so ensure you use a data type that can accommodate it (e.g., a 64-bit integer like long in Java or long long in C++).
24
6 4
1. The given number is n = 24.
2. Reversing the digits of 24 gives 42.
3. Squaring the reversed number: 42 * 42 = 1764.
4. The even digits in 1764 are 6 and 4.
120
4 4
1. The given number is n = 120.
2. Reversing the digits of 120 gives 021, which is treated as 21.
3. Squaring the reversed number: 21 * 21 = 441.
4. The even digits in 441 are 4 and 4.
The expected time complexity is O(log n), as the operations depend on the number of digits in 'n'.
1 <= n <= 10^9
Time limit: 1sec
The expected time complexity is O(log n), as the operations depend on the number of digits in 'n'.