Python3 queue
\n\n# Code\n\nclass Solution:\n    def timeRequiredToBuy(self, tickets: List[int], k: int) -> int:\n        \n        n=len(tickets)\n        q=deque([i for i i
\n\n# Code\n```\nclass Solution:\n    def timeRequiredToBuy(self, tickets: List[int], k: int) -> int:\n        \n        n=len(tickets)\n        q=deque([i for i in range(n)])\n        \n        time=0\n        \n        while q:\n            for i in range(len(q)):\n\n                node=q.popleft()\n                tickets[node]-=1\n                if tickets[node]>=1:\n                    q.append(node)\n                \n                time+=1\n                if tickets[k]==0:\n                    return time\n                \n                \n        \n```
['Queue', 'Python', 'Python3']