1 ms Java solution
```\n public int timeRequiredToBuy(int[] tickets, int k) {\n        \n        int seconds = 0;\n        int i = 0;\n        while(tickets[k] != 0)\n        {\n 
```\n public int timeRequiredToBuy(int[] tickets, int k) {\n        \n        int seconds = 0;\n        int i = 0;\n        while(tickets[k] != 0)\n        {\n            if(tickets[i] != 0)\n            {\n                tickets[i] = tickets[i] -1;\n                seconds++;\n            }\n            if(i == tickets.length - 1)\n            {\n                i = 0;\n                continue;\n            }\n                i++;\n        }\n\n        return seconds;\n    }\n
['Java']