How to reverse an Integer ?

[Question]: Reverse Integer in swift ex. 12345 => 54321 output should lie in Int32 Range TC: O(n)SC: O(1) Explanation: Here we are multiplying result with10 further adding it to modulo(reminder) & get last element by divide by 10 Example – 7913 ==== 3197 r 0 30 310 3190 r 3 31 319 3197 x 791 …

How to reverse an Integer ? Read More »