DEV Community


Discussion on: Backspace String Comparisons: Two Ways To Approach a Common Algorithm

khuongduybui profile image
Duy K. Bui

Isn't the point of having 2 pointers is to have them move together?

I think if you rewrite your if / else chain a little bit and break it out into 2 separate if blocks, then you can always decrease i and j together (at least until one of them reaches 0).