Coffee Prep Checker
Given the number of coffee beans in grams and the amount of water in milliliters, determine if there are enough beans to brew a standard cup of coffee. A standard cup requires at least 15 grams of beans. If the beans are sufficient, return true; otherwise return false.
For example, with 20g beans and any amount of water, return true. With 10g beans, return false regardless of water amount. With exactly 15g beans, return true.
This problem teaches threshold comparison — checking if a value meets or exceeds a minimum requirement. This pattern is used in inventory management, quality control, and resource allocation.
The solution simply compares the bean amount to the 15-gram threshold. If beans >= 15, there is enough for a standard cup. The water amount is provided for context but does not affect the result — the limiting factor is the beans.
Edge cases include zero beans (false), exactly 15 beans (true), and large amounts of beans (true). The water parameter is ignored in the logic.
Algorithm Flow

Solution Approach
Compare the bean amount to the 15-gram minimum threshold and return the boolean result.
Return the result of beans >= 15. This produces true when the available beans meet or exceed the 15-gram minimum required for a standard cup of coffee. The water amount is provided as a parameter for real-world context but does not affect the brewing decision in this simplified version.
Time complexity is O(1), space complexity is O(1).
Best Answers
program coffee_prep
dictionary
weight: integer
algorithm
input(weight)
if weight >= 15 then
output("READY")
else
output("NOT ENOUGH")
endif
endprogramComments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this Challenge.
