Can u please help me solving this
Yes this is actually a gcd problem. The amount of water in each jug is always a [linear combination] of a and b adn this linear combination has to be a multiple of gcd of a and b.
See this https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-042j-mathematics-for-computer-science-fall-2010/readings/MIT6_042JF10_chap04.pdf
If you still fail to understand this person solves the exact same problem https://www.youtube.com/watch?v=D-DYtUmRMa4
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen