Code Logo

Check Refill Needed

Published at19 Apr 2026
Easy 0 views
Like0

This problem is based on a simple refill check, like looking at the water level in a dispenser or soap container. You want to know whether the level is still okay or whether it is time to refill it.

You are given the current level and the minimum safe level. If the current level is less than or equal to the minimum, print REFILL. Otherwise, print OK.

For example, if the current level is 3 and the minimum safe level is 5, the answer is REFILL. But if the current level is 8, the answer is OK.

So the task is to compare the current level with the safe threshold and print the correct message.

Example Input & Output

Example 1
Input
current_level = 5, minimum_level = 5
Output
REFILL
Explanation

Matching the minimum level still counts as refill time.

Example 2
Input
current_level = 8, minimum_level = 5
Output
OK
Explanation

The level is still comfortably above the minimum.

Example 3
Input
current_level = 3, minimum_level = 5
Output
REFILL
Explanation

The current level is already below the safe threshold.

Algorithm Flow

Recommendation Algorithm Flow for Check Refill Needed
Recommendation Algorithm Flow for Check Refill Needed

Solution Approach

A simple way to solve this is to make one comparison.

First, read the current level and the minimum safe level. Then check whether the current level is less than or equal to the minimum.

The condition is:

current_level <= minimum_level

If that condition is true, the level is too low, so you print REFILL.

If that condition is false, the level is still fine, so you print OK.

This problem is just a threshold check, which makes it a nice short practice problem for conditionals.

Best Answers

Solutions Coming Soon

Verified best solutions for this Challenge are still being analyzed and will be available soon.