restore the dynamic programming method to the simplest form
add new algo. gettting rid of effect of length of T in the complexity
sol of q076