Comcast interview question

Focus on dp, array problems