You have n pots, each having a random amount of water in it, the total amount of water in all the pots is 2*n, you need to distribute the water among the pots equally so that each pot will have exactly 2 liters in it...

Find an algorithm to come up with the best solution with the minimum amount of steps, in each step you can only pour water from 1 pot to another...

Doesn't matter the complexity of the algorithm itself, only that the solution is shortest, but ofcourse faster algorithms are better...

## Question

## Guest

You have n pots, each having a random amount of water in it, the total amount of water in all the pots is 2*n, you need to distribute the water among the pots equally so that each pot will have exactly 2 liters in it...

Find an algorithm to come up with the best solution with the minimum amount of steps, in each step you can only pour water from 1 pot to another...

Doesn't matter the complexity of the algorithm itself, only that the solution is shortest, but ofcourse faster algorithms are better...

## Link to post

## Share on other sites

## 4 answers to this question

## Recommended Posts

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.