add iterative implementation
(only need to go over the list once but with two runners)