Posted on November 20, 2021November 20, 2021 Description Submission class Solution { int dfs(long long n) { if(n == 1) return 0; if(n % 2 == 0) return dfs(n>>1) + 1; return min(dfs(n-1), dfs(n+1)) + 1; } public: int integerReplacement(int n) { return dfs(n); } }; By Bill0412 LeetCode Medium