01 · Question
We have an empty container with a capacity of a gallons of water and another container with a capacity of b gallons. Return how many times you can pour the second container full of water into the first one without overflowing. Assume that a > b.
Constraint: You are not allowed to use the division operation, but you can use still divide by powers of two with the right-shift operator, >>. Recall that x >> 1 is the same as x // 2.
Example:
- Input:
a = 18, b = 5 - Output:
3(53 = 15 <= 18, but 54 = 20 > 18)