Regarding power(O(logn)) problem

unable to find logic for this problem for the give time complexity… kindly help

Using divide and conquer technique we can observe the following recurrence
power(x, n) = power(x, n / 2) * power(x, n / 2); // else n is even
power(x, n) = x * power(x, n / 2) * power(x, n / 2); // if n is odd
Code

But how to use BitMasking over here ??

please refer to this tutorial

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.