Skip to content

Instantly share code, notes, and snippets.

@germanescobar
Last active July 23, 2022 00:04
Show Gist options
  • Save germanescobar/60c741f9cc0bd45108f4e69c6b18fb07 to your computer and use it in GitHub Desktop.
Save germanescobar/60c741f9cc0bd45108f4e69c6b18fb07 to your computer and use it in GitHub Desktop.
// Pseudocódigo
plusOne(digits):
done = false
for i=digits.length-1; i >= 0 && !done; i--
if digits[i] < 9
digits[i]++
done = true
else
digits[i] = 0
if !done
digits.prepend(1)
return digits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment