✅ Simple Java Code --> Easy Approach..✅ 0ms RunTime
Intuition\nAs per the question given we need to increment the array value by one and return the resultant array with ith digit at ith position of that array For
# Intuition\nAs per the question given we need to increment the array value by one and return the resultant array with ith digit at ith position of that array For example: digits=[1,2,3] after adding one to this array i.e, 123+1=124 ...gives digits=[1,2,4] \n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nHere we need to notice that the input maybe given any large integer value so we cannot convert our array into number and increemnt and convert it back as an array instead i followed this follwing logic by taking one place and comparing whether its less than 9 or equal to 9.\nif its equal to 9 go and check for next ith digit else increment this digit by one and return the array\nFor better undertanding please see these below steps:\n1. As its already an int[] array given the last element of the array will be considered as the units place of the number we need to add 1 for last digit if its less than 9\n2. if the last element is greater than 9 we need to check for before element and increment if its less than 9..\n3. if all the elements are 9 we need add another element to the array\nfor example: [9,9] --> [1,0,0]\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    StringBuilder s=new StringBuilder();\n    public int[] plusOne(int[] digits) {\n        for(int i=(digits.length)-1;i >= 0;i--){\n            if(digits[i]<9){\n                digits[i]=digits[i]+1;\n                return digits;\n            }else if(digits[i]==9){\n                digits[i]=0;\n            }   \n        }\n        int[] newarr=new int[digits.length+1];\n        newarr[0]=1;\n        return newarr;\n    }\n}\n```\n![upvote.png](https://assets.leetcode.com/users/images/239c196e-5f36-48cc-b148-20966d5a3f9f_1687449464.7053354.png)\n\n\n\n**Guys please upvote if you find my solution worthy!! Thanks!**
['Java']