Integer Replacement Leetcode Solution