624 and 1137 - Dynamic programming