Practice Minimum Amount of Time to Fill Cups
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You have a water dispenser that can dispense cold, warm, and hot water. Every second, you can either fill up 2 cups with different types of water, or 1 cup of any type of water. You are given a 0-indexed integer array amount of length 3 where amount[0], amount[1], and amount[2] denote the number of cold, warm, and hot water cups you need to fill respectively. Return the minimum number of seconds needed to fill up all the cups.
Source: Minimum Amount of Time to Fill Cups on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
amount = [1,4,2]
4
# Example 2
amount = [5,4,4]
7
# Example 3
amount = [5,0,0]
5
Constraints
Related LeetCode Problems
Practice more problems similar to Minimum Amount of Time to Fill Cups.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.