Deloitte Interview Question

Some hard DP problem and Trees Problem