adicionado comentario sobre resolucao

This commit is contained in:
2025-02-12 18:02:15 +00:00
parent ca02eb659f
commit c25cd97ea1

View File

@ -5,9 +5,12 @@
#
# Increment the large integer by one and return the resulting array of digits.
# só é preciso incrementar o valor no ultimo indice
# -> mas e se o numero for '129'? o resultado correcto será '130' e não '120'
#
# increment by one the last index of the array.
# iterate backwards, from the last index until index 0,
# if the index as a value of 10, set it to 0;
# if this is the index 0, insert the value 1 at index 1,
# otherwise increment the previous index by 1
# (we are running backwards in the array)
def plusOne(digits: list[int]) -> list[int]: