Given a number represented as an array of digits, plus one to the number.
---
return Arrays.copyOfRange(rst, 1, n+1); ---
public class Solution { public int[] plusOne(int[] digits) { int n = digits.length; int[] rst = new int[n+1]; int carry = 1; for(int i=n-1; i>=0; i--){ rst[i+1] = (carry + digits[i]) % 10; carry = (carry + digits[i]) / 10; } if(carry == 1){ rst[0] = 1; return rst; }else{ return Arrays.copyOfRange(rst, 1, n+1); } }}