JAVA solution || PriorityQueue
the quetion it is to find the minimum time ,and given that can fill 2 at a time or 1 \n* to find minimum first fill how many times 2 cups can be filled using pr
* the quetion it is to find the minimum time ,and given that can fill 2 at a time or 1 \n* to find minimum first fill how many times 2 cups can be filled using priority queue(filling last maximum 2 cups) and remaining will be a left out cup fill it directly with that value.\n\n```\nclass Solution {\n    public int fillCups(int[] nums) {\n        int c=0,t1=0,t2=0;\n        PriorityQueue<Integer>q=new PriorityQueue<>(Collections.reverseOrder());\n         for(int i:nums)\n             q.add(i);\n        while(q.peek()!=0){\n            t1=q.remove();\n            t2=q.remove();\n            if(t2!=0){\n                q.add(t1-1);\n                q.add(t2-1);\n                c++;\n            }\n            else return c+t1;\n        }\n        return c;\n    }\n}\n```
['Heap (Priority Queue)', 'Java']