title: Confusion related to dynamic programming
body: <p>I was going through this page related to dynamic programming. I am a big confused about the complexity given</p>
  
  <p><img src="https://i.stack.imgur.com/7jfrJ.jpg" alt="enter image description here"></p>
  
  <p>Here in the third case the complexity is given as $O(n^2)$. I am not sure how it came to be that. Can anyone please elaborate. How the complexities were calculated here.</p>