The first assignment is done by realizing two bits of algebra: Instead of re-computing sub-arrays over and over, save the results and re-use them. This reduces the complexity from O(n 3) to O(n 2).
Some results have been hidden because they may be inaccessible to you
Show inaccessible results