Pergunta de entrevista da empresa X

4 hard problems, probably leetcode dp, can't remember exactly