rewrite leetcode pow