Not sure if you have solved this, but if I were you I will process the array in reverse (ie start from the last index). This way, the index will never be changed when an item is removed.
Not sure if you have solved this, but if I were you I will process the array in reverse (ie start from the last index). This way, the index will never be changed when an item is removed.