Importance of time

isme stack use hoga ya queue, explain kar dijiye

hi @ritikbunty2511_729d0258992e0982,

  • The Idea is to Store the Calling order in Queue and the ideal order in an Array.
  • Then compare front element of the queue with the ideal order.
  • If it matches then increment the time and remove the element.
  • Else, Dequeue the element and enqueue it again.
  • The loop will run till the queue is consumed totally.