LeetCode solutions

2412. Minimum Amount of Time to Fill Cups

My accepted Python solution to LeetCode problem 2412, Minimum Amount of Time to Fill Cups, running in 0ms.

  • Difficulty: Easy
  • Python
  • Runtime 0ms
  • Memory 17.2MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 0ms, memory 17.2MB, accepted 2025-12-29.

python
class Solution:
    def fillCups(self, amount: List[int]) -> int:
        amount.sort()
        # If the largest is >= sum of other two, answer is the largest
        if amount[2] >= amount[0] + amount[1]:
            return amount[2]
        # Otherwise, we can pair them optimally
        return (sum(amount) + 1) // 2

Source