Q: You have two empty water jugs in your hands. One holds 3 gallons of water, the other holds 5 gallons of water.
You need to use these two jugs to measure exactly 4 gallons of water.
The answer is: 
To measure exactly 4 gallons of water using a 3-gallon jug and a 5-gallon jug, you can follow these steps pattern:

1.	Map Values: A: Bigger jug size = 5, B: smallest jug size = 3, C: water in the bigger jug, D: water in the smallest jug. E = target = 4
2.	Fill Up A completely (Fill the 5-jug up completely)
3.	Use the water from A to fill up the B (Use the water from the 5-jug to fill up the 3-jug)
4.	Pour out the B. You're left with nothing in the B and (C=A-B) in the A (Pour out the 3-gallon jug. You're left with nothing in the 3-jug and 2 gallons in the 5-jug)
5.	if (A or B == E) stop else continue in the same pattern
6.	Transfer the water from A to the B. You're left with C gallons in the B. And nothing in the A (Transfer the water from the 5-jug to the three jug. You're left with 2 gallons in the 3-jug. And nothing in the 5-jug).
7.	Fill up the A completely. You now have C gallons in the B and A in the A-jug. This means that there is (B-C ) 1 gallon of space left in the B in this case (Fill up the 5-jug completely. You now have 2 gallons in the 3-jug and 5 in the 5-jug. This means that there is 1 gallon of space left in the 3-jug).
8.	Use the water from the A to fill up the B (Use the water from the 5-jug to fill up the 3-jug. Fill up the last gallon of space in the 3-jug with the water from the 5-jug. This leaves you with 3 gallons in the 3-jug, and 4 gallons in the 5-jug)
9.	if (A or B == E ) stop else continue in the same pattern
The correct answer of Q is
1.	 Fill the 5-jug up completely. 
2.	Use the water from the 5-jug to fill up the 3-jug.
3.	Pour out the 3-gallon jug. You're left with nothing in the 3-jug and 2 gallons in the 5-jug.
4.	Transfer the water from the 5-jug to the three jug. You're left with 2 gallons in the 3-jug. And nothing in the 5-jug.
5.	Fill up the 5-jug completely. You now have 2 gallons in the 3-jug and 5 in the 5-jug. This means that there is 1 gallon (3.8 L) of space left in the 3-jug.
6.	Use the water from the 5-jug to fill up the 3-jug. Fill up the last gallon of space in the 3-jug with the water from the 5-jug. This leaves you with 3 gallons in the 3-jug, and 4 gallons in the 5-jug.

Q: You have two empty water jugs in your hands. One holds 7 gallons of water, the other holds 5 gallons of water. You need to use these two jugs to measure exactly 6 gallons of water.
 Avoid using the following keywords: case, =, water, value
user