JS Faster than 93% O(n)
First we add 1 to the last element. \nThen, we iteratively check starting from least significant to most significant if the digit is a 10. \nIf it is, we set it
First we add 1 to the last element. \nThen, we iteratively check starting from least significant to most significant if the digit is a 10. \nIf it is, we set it to 0 and to the digit before it we add 1.\nOnce we are done with this, we update the first digit if it\'s a 10, adding a digit of 1 in front of it.\n```\nconst plusOne = (digits) => {\n  const last = digits.length - 1;\n  digits[last]++;\n  for (let i = last; i > 0 && digits[i] === 10; i--) {\n    digits[i] = 0;\n    digits[i - 1]++;\n  }\n  if (digits[0] === 10) {\n    digits[0] = 0;\n    digits.unshift(1);\n  }\n  return digits;\n};\n```
['JavaScript']