Confusion related to calculating time complexity
Let $T(i)$ be the running time of opt(i) then we have
$$ T(i)= \sum_{k=i}^n T(k+1).$$
You have not specified a recursion anchor, but I guess it is something like $T(n+1)=1$. Write down the series $T(n),T(n-1),T(n-2),\dots$ and you get the impression that $T(i)=2^{n-i}$. This guess can be proven by induction, since assuming that $T(i)=2^{n-i}$, we have
$$ T(i-1)= \sum_{k=i-1}^n T(k+1)= T(i)+\sum_{k=i}^n T(k+1)= 2 T(i) = 2^{n-(i-1)} .$$

Thus, $T(0)= 2^n$ and therefore it is not in $O(n^2)$.

PS I assumed that in the recursion the value of opt is never stored and will always be recomputed.