傻做就O(n), 要更好就考虑O(logN). 1. If n == even: return val * val 2. If n != even: return val * val * x; Also, consider the sign of x.
Some results have been hidden because they may be inaccessible to you
Show inaccessible resultsSome results have been hidden because they may be inaccessible to you
Show inaccessible results