- You are given two numbers n and k.
- You are required to rotate n, k times to the right/left.
- If k is positive, rotate to the right i.e. remove rightmost digit and make it leftmost.
- Do the reverse for negative value of k.
- Also k can have an absolute value larger than number of digits in n..
- Print the rotated number.
- Note - Assume that the number of rotations will not cause leading 0's in the result. e.g. such an input will not be given
n = 12340056, k = 3, r = 05612340
Example 1:
Input: 27391 2 Output: 91273
Example 2:
Input: 27391 6 Output: 12739
Example 3:
Input: 27391 -2 Output: 39127
Constraints:
1 <= n < 10^9
-10^9 < k < 10^9