Last active
July 23, 2022 00:04
-
-
Save germanescobar/60c741f9cc0bd45108f4e69c6b18fb07 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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