How to use stack in this question?

what is the use of a circular array here and how to use the stack in this question? with normal sorting method, only 50% cases passed

@rohitkandpal683 refer here method 2


i hope its clear if yes dont forget to mark it as resolved :smiley: