You are at the side of a river. You are given a 3-litre jug and a 5-litre jug. Both the jugs are initially empty. The jugs don’t have markings to allow measuring smaller quantities. You have to use the jugs to measure 4 litres of water. Determine the minimum no of operations to be performed to obtain 4 litres of water in one of the jugs. The operations you can perform are :
- Empty a Jug
- Fill a Jug
- Pour water from one jug to the other until one of the jugs is either empty or full.
The answer is an integer. Just put the number without any decimal places.