Pergunta de entrevista da empresa TikTok

Medium graph/DP problem with recursion