Impact Analytics Interview Question

Medium level dynamic programming question