1.Time cost of your first method:
T(n) = 2T(n / 2) + O(1)
2.Time cost of your second method:
T(n) = 3T(n / 2) + O(1)
= O( n ^ log2(3) )
It's a big difference between those two method!
That's why the second method shows Time Limit Exceeded
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.