🔥Easy||✅Cute||😎Perfecto||💥Beginner Friendly
\n# Code\n\nclass Solution {\n    public int timeRequiredToBuy(int[] tickets, int k) {\n        int total = 0;\n\n        for (int i = 0; i < tickets.length; i+
\n# Code\n```\nclass Solution {\n    public int timeRequiredToBuy(int[] tickets, int k) {\n        int total = 0;\n\n        for (int i = 0; i < tickets.length; i++) {\n            if (i <= k) {\n                total += Math.min(tickets[i], tickets[k]);\n            } else {\n                total += Math.min(tickets[i], tickets[k] - 1);\n            }\n        }\n\n        return total;\n    }\n}\n```
['Java']