🙏  C++,Basic Math, 100% beats both time and space complexity
Hi EveryOne , In this I am going to solve this question using basic mathematics.\nTime Complexity O(n) and Space Complexity O(1)\n\nEquation 1-> Each second we 
Hi EveryOne , In this I am going to solve this question using basic mathematics.\n**Time Complexity O(n) and Space Complexity O(1)**\n\n**Equation 1->**  ```Each second we fill (either different or same cup) we cannot reduce the amount of  cups(of one type) to be filled by more than 1 so we need atleast max(amount) seconds to fill all solution. Got it ? So sol>=max(amount)```\n**Equation 2 ->**  ```what will be minimum second required if we fill 2 cups each second then we will need ceil((total amount to fill)/2) So Solution would be Sol>=((total+1)/2)```\n\t\n\tOverall solution should satisfy both equations.\n\n```\nclass Solution {\npublic:\n    int fillCups(vector<int>& amount) {\n        int maxi=0;\n        int total =0;\n        for(int i=0;i<amount.size();i++){\n            total+=amount[i];\n            maxi=max(maxi,amount[i]);\n        }\n        // It is based on basic Math\n        /** Case I EQUATION I- Each second we fill (either different or same cup) \n\t\twe cannot reduce the amount of maximum cups to be filled by more than 1\n\t\tso we need atleast max(amount) seconds to \n\t\tfill all solution. Got it ? \n\t\tSo sol>=max(amount)\n\t\t\n        Equation 2 -> what will be minimum second required \n\t\tif we fill 2 cups each second then we will need ceil((total amount to fill)/2) \n\t\tSo Solution would be Sol>=((total+1)/2)\n        **/\n        // Overall solution should satisfy both equations.\n        return max(maxi,(total+1)/2);\n    }\n};\n```\n\n**Please Upvote if you like it and if you have any query. comment section is all yours \uD83D\uDE4F**\n\n![image](https://assets.leetcode.com/users/images/0361682b-5ca2-4de6-a165-98a34a86ca10_1657468906.6017098.png)\n
['Math', 'C++']