Code Challenge / Algorithm
I solced Stretch Goal
The animal’s name is added to the respective list based on its species. This operation has a constant time complexity of O(1).
The dequeue function removes an animal from the shelter based on the provided preference. If the preference is “dog” or “cat”, the corresponding list is checked for availability, and the first element is removed and returned. If the preference is “cat_or_dog”, the dogs list is checked first, then the cats list. The first available animal is removed and returned. The dequeue operation has a constant time complexity of O(1) for accessing and removing the first element from a list.
The space complexity of the implementation is O(n), where n is the total number of animals in the shelter. This is because the space required to store the animal names in the lists grows linearly with the number of animals.
i used chatgpt to write doc str foe me code