Find how much the first bear must eat to become strictly heavier than the second bear.
Two bears have weights and . The first bear wants to be strictly heavier than the second bear. Each year, the first bear gains weight by multiplying its weight by 3, while the second bear gains weight by multiplying its weight by 2.
Your task is to determine the minimum number of years after which the first bear's weight becomes strictly greater than the second bear's weight.
Example 1
Input
4 7
Output
2
Explanation
After 1 year: and , so the first bear is still lighter. After 2 years: and , so the first bear becomes heavier.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.