Deloitte interview question

Some hard DP problem and Trees Problem