Java | Simple code | 100% faster
\nclass Solution {\n    public int timeRequiredToBuy(int[] tickets, int k) {\n        int seconds = 0;\n        for(int i = 0; i < tickets.length; i++){\n      
```\nclass Solution {\n    public int timeRequiredToBuy(int[] tickets, int k) {\n        int seconds = 0;\n        for(int i = 0; i < tickets.length; i++){\n            if(tickets[i] < tickets[k]) seconds += tickets[i]; // only add the time needed to buy his tickets\n            else{\n                if(i <= k) seconds += tickets[k]; \n                else seconds += tickets[k] - 1; \n            }\n        }\n        return seconds;\n    }\n}\n```
['Java']