Here is how you can find the answer without any hints, just by using math.
Start unrolling the recursion: .
The recursion will at some point stop, so we have to find a reasonable stopping point. Trying 0, 1, 2, you can see that 2 looks good, because you can easily solve the equation: .
Solving it, you get .
So the recursion will continue log(log(n))
times and this is your time complexity.
P.S. a little bit harder recurrence was solved here.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…