Java solution || Easy to Undersatnd &  Explained in Detail
\n# Approach\n Describe your approach to solving the problem. \n * we started checking from back if last digit is less than 9 we simply add one one to the digit
\n# Approach\n<!-- Describe your approach to solving the problem. -->\n * we started checking from back if last digit is less than 9 we simply add one one to the digit and return the digit.\n *  otherwise the case will be last digit was 9 so we make the digit 0 as we know 9+1 = 10 so last digit in these cases need to be 0 so we do that.\n *  here we create a new array of size input given to us +1 so that we can actually add 1 to beginning of our new array and we retuen the new array thats it.For ex:[9,9,9] = [1,0,0,0] in this case we need one more digit space as we need to carry 1 so in this way we do this.\n\n\n**If it is helpful please do upvote,Happy coding!!\n**\n\n\n# Code\n```\nclass Solution {\n    public int[] plusOne(int[] digits) {\n        int n = digits.length;\n        for(int i=n-1;i>=0;i--){  \n            if(digits[i]<9){\n                digits[i]++;\n                return digits;\n            }\n            else{\n                digits[i]=0;\n            }\n        }\n        int [] arr = new int[n+1];\n        arr[0]=1;\n        return arr;\n        \n    }\n}\n```
['Java']