You use a cache (memo) and use shifting instead of division. The code is reasonably fast enough.
You could probably seed if up by writing it in assembly, but the question is how much extra speed you need and how much trouble are you willing to go through for it.
You could do a slight optimization by removing the n == 1 check and instead adding memo[1] = 1 during the initialization. One less branching for the code to do. :)
For correctness, you should check for any overflow happening during your calculations. Have a look at this thread: https://stackoverflow.com/questions/199333/how-do-i-detect-unsigned-integer-overflow, especially to the answer where <stdckdint.h> is mentioned. I am not sure though, if that's available on OnlineGDB yet.
I do not remember the maths behind this. What is this problem called?
Is this like an unsolved problem where we do not know if there will be a loop ever or something? If not, you could just build from the other way around: start multiplying by 2 (number *= 2) until you find a number where (number - 1) % 3 == 0 and then you perform the reduction: number = (number - 1) / 3. The largest number you can find like this should have the longest string of operations, right? So you do not have to try all the numbers from A to B. :)
Never mind, that does not work as the algorithm cannot guarantee that there won't be any smaller numbers if you keep going with the calculations, so one cannot just stop as soon as one finds a number larger than a defined maximum.