VERY EASY | JAVA SOLUTION | USING QUEUE
\n\n# Code\n\nclass Solution {\n    public int timeRequiredToBuy(int[] tickets, int k) {\n        Queue<Integer> queue = new LinkedList<>();\n        int ans = 
\n\n# Code\n```\nclass Solution {\n    public int timeRequiredToBuy(int[] tickets, int k) {\n        Queue<Integer> queue = new LinkedList<>();\n        int ans = 0;\n        for(int i = 0; i < tickets.length; i++){\n            queue.add(i);\n        }\n        while(!queue.isEmpty()){\n            int index = queue.poll();\n            tickets[index]--;\n            ans++;\n            if(tickets[index] == 0 && index == k){\n                return ans;\n            }\n            if(tickets[index] > 0){\n                queue.add(index);\n            }\n        }\n        return ans;\n    }\n}\n```
['Queue', 'Java']