Compute (x raised to the power ). The naive approach multiplies by itself times, which takes time.
But you can do better using logarithms. The key observation: when is even. This lets you halve the exponent at each step.
Before reading the solution, think about this: how many times can you halve before reaching ? That's your clue to the time complexity.