Pergunta de entrevista da empresa TikTok

Two questions in the first round of VO. The first one is a difference array, the second is dp.