educative.io

Time Complexity of Memoization Solution

Hi,

What will be the overall time complexity of the memoization solution and how can we achieve that?

Thanks heaps.


Course: Grokking the Coding Interview: Patterns for Coding Questions - Learn Interactively
Lesson: Solution Review: Problem Challenge 1 - Grokking the Coding Interview: Patterns for Coding Questions

Hello @Andrew_Pham ,
The time complexity will be O(n^2) because of the use of nested loops in the code. Hope this answers your query.