Question: When using a stack to reverse a string, what is the time complexity of the entire operation?
Options:
Correct Answer: O(n)
Solution:
Reversing a string using a stack involves pushing each character onto the stack and then popping them off, resulting in a time complexity of O(n).