public class Solution {

public int[] plusOne(int[] digits) {

int n=digits.length;

for(int i=n-1;i>=0;i--){

if (digits[i] <9){

digits[i] +=1;

return digits;

}

else{

digits[i]=0;

}

```
}
int[] newNum=new int [n+1];
newNum[0] += 1;
return newNum;
}
```

}

this should be optimal , right? O(n)

but I only beats 6% of submissions .

can this kinda answer satisfy interviewer in real interview ?