Animal Shelter Queue LeetCode (Animal Shelter Simulation Using Queue)

 Construct animal queue that consists of the following features:

  1. Contains Cats and Dogs
  2. If not preference on animal type is needed, then fetch the animal that was placed first in the queue
  3. If Cat is needed then fetch the Cat that was added first
  4. If Dog is needed then fetch the Dog that was added first
This is an interesting real-world use of Queue data structure and is well discussed in several coding and algorithm books, including Cracking the coding Interview, and several other coding forums - Page1 A collection of hundreds of interview questions and solutions are available in our blog at Interview Question

Solution

No comments:

Post a Comment