some o dat dynamic programming swag