left
at the start of the string and right
at the end.left
is less than or equal to right
:
a. Check if the character at left
is in the hashmap.
b. If not, return false
.
c. Retrieve the expected character that should be at right
from the hashmap.
d. If the character at right
does not match the expected character, return false
.
e. Increment left
and decrement right
.true
.