🚀 Simple Python Solution | Pointer Approach ✅
Approach\n Describe your approach to solving the problem. \n- set result count to 0\n- iterate to tickets if currunt is not 0 then increase the res and remove t
# Approach\n<!-- Describe your approach to solving the problem. -->\n- set result count to 0\n- iterate to `tickets` if currunt is not 0 then increase the `res` and remove the 1 ticket from `tickets[i]` else skip the person\n- if the `tickets[k]` is equal to 0 than break the loop and return the `res`\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n$$O(n)$$, to iterate the persone queue \n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n$$O(1)$$, store the counts of the tickets are boughts, \n\n# Code\n```\nclass Solution:\n    def timeRequiredToBuy(self, tickets: List[int], k: int) -> int:\n        res = 0\n        i,n = 0, len(tickets)\n        while True:\n            if i >= n:\n                i = 0\n\n            if tickets[k] == 0:\n                break\n\n            if tickets[i] != 0:\n                res += 1\n                tickets[i] -= 1\n            \n            i += 1\n                \n        return res\n```
['Python', 'Python3']