Take also a look at dynamic programming.

Yeah, there is an equation, and that's mathematical. ;)

This comment is hidden because it contains spoiler information about the solution

should probably be using str.join instead of concatenating using +=

Take also a look at dynamic programming.

Yeah, there is an equation, and that's mathematical. ;)

This comment is hidden because it contains spoiler information about the solution

This comment is hidden because it contains spoiler information about the solution

This comment is hidden because it contains spoiler information about the solution

should probably be using str.join instead of concatenating using +=