super simple java solution | explained | 0ms faster than 100%
```\nclass Solution {\n    public int[] plusOne(int[] digits) {\n        int len = digits.length; // length of array;\n        \n        // start the loop from 
```\nclass Solution {\n    public int[] plusOne(int[] digits) {\n        int len = digits.length; // length of array;\n        \n        // start the loop from last index;\n        for (int i = len-1; i>=0; i--) {\n            // if ith index is 9, that means there will be an overflow if we add 1\n            // adding 1 will make it 10, so we set it to 0. and continue the loop; \n            if (digits[i] == 9) {\n                digits[i] = 0;\n            }else {\n                // if ith value is not 9 we just add 1 to it and return;\n                digits[i] += 1;\n                return digits;\n            }     \n        }\n        \n        // if we are here, that means all the value of the array were 9;\n        // and they are 0 now;\n        // example: [9,9,9,9], after loop becomes [0,0,0,0];\n        // so we have to create a new array of +1 length of the previous.\n        // and place 1 at 0th index;\n        int[] arr = new int[len+1];\n        arr[0] = 1;\n        return arr;\n    }\n}
['Java']