Swaps characters from both ends toward the middle using two pointers; O(n) time, O(1) space.
## What is it?
Reversing a string means producing a new string (or modifying in-place) where characters appear in the opposite order. It is one of the most fundamental string manipulation techniques.
## How it works
**Two-pointer approach (in-place for char arrays):**
- Place `left = 0`, `right = n-1`
- Swap `str[left]` and `str[right]`
- Move `left++` and `right--`
- Repeat until `left >= right`
**Using a stack:**
- Push each character onto a stack
- Pop characters off the stack to form the reversed string
## When to use
- Palindrome checking (compare original vs reversed)
- Reversing words in a sentence
- Part of larger string manipulation problems
- Anagram detection via sorted strings
## Key Points
- In-place two-pointer swap is the most space-efficient approach: O(1)
- Python: `s[::-1]` reverses in O(n) time but O(n) space (new string)
- Java strings are immutable — use a `char[]` or `StringBuilder`