1class Solution {2 public:3 int integerReplacement(int n) {4 return helper(n);5 }67 int helper(long n) {8 if (n == 1) return 0;910 if (n % 2) return 1 + min(helper(n - 1), helper(n + 1));1112 return 1 + helper(n / 2);13 }14};
WPM •0 •0
ACC •0 •0
TIME •0