結果 : two pointer approach in javascript