I was trying to solve
$T(n) = T(n-1)+\log^2(n)$
using substitution method and variables substitution but I can't find the correct answer.
My attempt:
Let $m = \log(n)$
then $T(2^m) = T(2^m-1)+m^2$
next, we assume that $S(m) = T(2^m)$
so $S(m) = S(m-1)+m^2$ but here I'm stuck with this passage and I can't continue. Am i doing something wrong? Any tips?
$T(n)-T(n-1)=\log^2(n)$, then $(T(n)-T(n-1))+(T(n-1)-T(n-2))+\ldots+(T(2)-T(1))=\log^2(n)+\ldots+\log^2(2)$, so $T(n)-T(1)=\log^2(n)+\ldots+\log^2(2)$, $$T(n)=T(1)+\sum_{k=2}^n\log^2(k)$$.