using two pointers to save and travel