Apple interview question

Dynamic programming and memory allocation