2119. A Number After a Double Reversal ¶
Approach 1: Naive¶
- Time: $O(\log\texttt{num})$
- Space: $O(1)$
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
1 2 3 4 5 6 7 8 9 10 11 12 |
|
Approach 2: Heuristic¶
- Time: $O(1)$
- Space: $O(1)$
1 2 3 4 5 6 |
|
1 2 3 4 5 |
|
1 2 3 |
|