|All-time Popular Problems|
|Maximum difference between node and its ancestor|
|Right View of Binary Tree|
|Delete without head pointer|
|Find the number of islands|
|Delete nodes having greater value on right|
|Reverse Level Order Traversal|
|Binary Tree to DLL|
|Find all pairs with a given sum|
|n'th node from end of linked list|
|Equal to product|
You are at the side of a river. You are given a m litre jug and a n litre jug where 0 < m < n. 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 d litres of water where d < n. Determine the minimum no of operations to be performed to obtain d litres of water in one of jug.
The operations you can perform are:
First line consists of T test cases. Only line of every test case consists of 3 spaced integers denoting m , n, and d respectively.
Single line output, print the minimum number of operations.
8 56 46
3 5 4