PLUS ONE | PYTHON | LEETCODE # 66 (FACEBOOK & GOOGLE INTERVIEW QUESTION)

preview_player
Показать описание
In this video we are solving an easy Leetcode question: Plus One.

This problem isn't particularly hard but it does have some patterns in it's solution that come up a lot in Leetcode interviews so definitely one to know for an upcoming interview. Likely you might get this one as a warm up or a phone screen question as they tend to be easier than the regular interview questions.
Рекомендации по теме
Комментарии
Автор

If we have a carry after iterating over the list doesnt it mean that all numbers in given array are 9? Then we can change first element to 1 and append 0 to end of the list in O(1) constant rather than inserting in O(n) time. It has no effect on general time complexity but reduces it overall)

akaysabirov