This process follows a bottom-up (iterative) solution. Since we are iterating through all of the numbers from 0
to n
just once, our time complexity is O(n)
and our space complexity will also be O(n)
. This is similar to our top-down solution just without the recursion. This solution is likely easier to understand and is more intuitive.
Mark As Completed Discussion

