You are viewing a single comment's thread. Return to all comments →
I thought of both editorial solution and hashmap solution but as the question belongs to dequeue category, I tried to get an answer using dequeue and couldn't make any logic. Then, I checked the editorial and I am really disappointed that it is not up to the mark.
This question does not belong to dequeue. Even, editorial have just used dequeue for no purpose. An array or hashmap would be sufficient. I must say that if you are putting a question under some category then atleast make that category applicable.