• + 1 comment

    Although simple enough, I think it still uses the thoguht of DP - it keeps recording the two former numbers and build the solution from bottom to top, instead of recurring from top to bottom, which would lead to a huge number of unnecessary function calls.