You are given a large integer represented as an integer array digits, where each digits[i] is the ith digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading 0’s.
Increment the large integer by one and return the resulting array of digits.
🪞 Reflections
Manually doing math can be a bit more confusing than it seems. It took me a few minutes to figure out the precise logic for carrying under any circumstance.
Still, this went well.
I didn’t catch any bugs while manually testing.
But a cursory code review after my initial implementation did catch that I was incrementing instead of decrementing my counter, which I quickly fixed before my first manual test case.