The Problem That Those With Algorithmic Intelligence Can Solve

Think you have an algorithmic mind? If your answer is yes, you can solve these two bucket problems, which companies often ask when hiring software engineers, without much difficulty!

We are here with a question that is asked especially in software-related job interviews and tests your algorithmic thinking. It with the question of logic You can also find out if you have an algorithmic intelligence.

This question asking you to take a measurement with two buckets, software engineer It is frequently encountered by people who are interviewed in fields such as: Then come to the question:

You have two buckets, one with a capacity of 3 and the other with a capacity of 5 liters. You can fill and empty these buckets with water.

You can completely fill or empty a container. You can also use the water in one container to fill the other container. The question is: Can you get 4 liters of water by filling and emptying these two buckets?

Let’s give you some time to solve the problem.

So let’s get to the answer now.

First of all this is an algorithm question, so We can reach the right result in different ways. We will tell you how to reach 4 liters of water in two different ways. While doing this, we will explain it in an algorithmic system, that is, step by step.

To reach 4 liters of water from a slightly longer route:

  1. Fill a 3 liter bucket with water.
  2. Pour this filled water into the 5-liter bucket. The 5 liter bucket now contains 3 liters of water.
  3. Refill the 3 liter bucket.
  4. Pour this water into the 5 liter bucket until the bucket is full. Now you have 1 liter of water left in the 3 liter bucket.
  5. Pour the water completely in the 5 liter bucket.
  6. Pour the remaining 1 liter of water from the 3 liter bucket into the 5 liter bucket.
  7. Refill the 3 liter bucket.
  8. Pour the water from the 3 liter bucket into the 5 liter bucket. You have 4 liters of water left.

Now let’s see how to get 4 liters of water with fewer steps.

  1. Fill the 5 liter bucket with water.
  2. Pour this water into the 3-liter bucket until it is full. There are 2 liters of water left in the 5 liter bucket.
  3. Empty the 3 liter bucket.
  4. Pour the 2 liters of water from the 5 liter bucket into the 3 liter bucket.
  5. Fill the 5 liter bucket completely.
  6. Pour the 5 liter bucket into the 3 liter bucket until it is full. You have 4 liters of water left.

So in how many steps did you find the answer? If you found the answer to your question in a different step, you can write to us in the comments.

Sources: Stack Exchange, Careercup

RELATED NEWS

How much do you know about the events in 2022? Most People Will Not Get All The Questions Correctly In This Test!


source site-40