How would you implement the two-pointer technique to reverse a string str = "Pointer"
?
Use one pointer at the beginning of the string and the other at the end, and swap the characters at these positions until the pointers meet in the middle.
Use one pointer to iterate through the string and shift each character to its opposite end.
Use two pointers starting at the beginning and the middle of the string, and swap elements until the middle is reached.
Use two pointers at the same position and swap the characters one at a time.
This question is part of this quiz :
Quiz on Two Pointer Technique for DSA