✅ One Line Solution
Time complexity: O(n). Space complexity: O(1).\n\nclass Solution:\n    def timeRequiredToBuy(self, t: List[int], k: int) -> int:\n        return sum(min(v,t[k]-
Time complexity: $$O(n)$$. Space complexity: $$O(1)$$.\n```\nclass Solution:\n    def timeRequiredToBuy(self, t: List[int], k: int) -> int:\n        return sum(min(v,t[k]-(i>k)) for i,v in enumerate(t))\n```
['Array', 'Python', 'Python3']