filmov
tv
LeetCode Problem 66. Plus One || Java Solution Walkthrough
![preview_player](https://i.ytimg.com/vi/omzLfGcCqkY/maxresdefault.jpg)
Показать описание
LeetCode is a great platform for people who want general coding practice, whether that be for interviews or just wanting to practice their problem solving. I will be taking you through all the steps of finding the optimal solution to each problem on the site following a logical ordering setout by LeetCode themselves.
In this video, we are going over the problem 66. Plus One, add one to the final index of the array, and cascade any needed changes up the array until we have determined the final array.
To solve this problem we can simply loop through the array starting at the end, and if the value at the current index is less than 9 then we don't have to do any carrying of digits, this means we can just return the array. But if we have values that are equal to 9, we will continue to carry over the remainder until the loop is complete or we hit a number not equal to 9.
~~~ Stay Up To Date With My Social Media ~~~
#unknownkoder #leetcode #algorithms
In this video, we are going over the problem 66. Plus One, add one to the final index of the array, and cascade any needed changes up the array until we have determined the final array.
To solve this problem we can simply loop through the array starting at the end, and if the value at the current index is less than 9 then we don't have to do any carrying of digits, this means we can just return the array. But if we have values that are equal to 9, we will continue to carry over the remainder until the loop is complete or we hit a number not equal to 9.
~~~ Stay Up To Date With My Social Media ~~~
#unknownkoder #leetcode #algorithms