Array iteration ensure fail

Your main problem is that you are trying to traverse an array and while doing this your are adding more items to it. You can traverse your array and keep a separate list of items to be added and once you finish traverse that array you get the separate list of items and add it to the original one.

1 Like