remove duplicate iterator from greedy algorithm