@@ -0,0 +1,950 @@
+/**%0A * Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.%0A * You may assume the integer do not contain any leading zero, except the number 0 itself.%0A * The digits are stored such that the most significant digit is at the head of the list.%0A */%0Apublic class Solution %7B%0A  public int%5B%5D plusOne(int%5B%5D digits) %7B%0A    // Start as 1 so that we dont need to add extra code to truly add one.%0A    int carry = 1;%0A    for (int i = digits.length - 1; i %3E= 0; i --) %7B%0A      int cur = digits%5Bi%5D;%0A      int sum = carry + cur;%0A      if (sum %3E 9) %7B%0A        digits%5Bi%5D = sum - 10;%0A        carry = 1;%0A      %7D else %7B%0A        digits%5Bi%5D = sum;%0A        carry = 0;%0A      %7D%0A%0A      if (carry == 0) break;%0A    %7D%0A%0A    if (carry %3E 0) %7B%0A      int%5B%5D temp = new int%5Bdigits.length + 1%5D;%0A      temp%5B0%5D = carry;%0A      for (int i = 0; i %3C digits.length; i ++)%0A        temp%5Bi + 1%5D = digits%5Bi%5D;%0A      return temp;%0A    %7D%0A%0A    return digits;%0A  %7D%0A%7D

Add plus one