LeetCode / Reverse Integer
Problem
- Link
- Description
- Reverse the digits of a number
- Type
- Brute Force
Solution 1
| |
- Description
- Extract digits one by one from the end using the modulo operator and store them in a queue
- Then retrieve digits from the queue one by one to construct the reversed number
- Time Complexity
- O(len(s))
- Space Complexity
- O(len(s))