Python O(n) time complexity -  faster than 97%
\nclass Solution(object):\n    def timeRequiredToBuy(self, tickets, k):\n        ans = 0\n        \n\t\t# people at the front will always get 1 ticket first\n\t
```\nclass Solution(object):\n    def timeRequiredToBuy(self, tickets, k):\n        ans = 0\n        \n\t\t# people at the front will always get 1 ticket first\n\t\t# get minimum to know how many times a person will queue and buy before kth person\n        for tix in range(k+1):\n            ans += min(tickets[tix], tickets[k])\n\n\t\t# contrary to people at the front, \n\t\t# kth person will only go behind everyone *(people initially behind k)* for tickets[k]-1 times \n        for tix in range(k+1, len(tickets)):\n            ans += min(tickets[tix], tickets[k]-1)\n            \n        return ans\n```
['Python']