At first I was mutating notVisitedAnimalsArray so it needed to be a copy not to change animalsArray.

But I changed how it works so you are right there is no need for copy anymore.