http://www.nxcoding.com/archives/leetcode-daily-1922-count-good-numbers-fast-power