Question d’entretien chez TikTok

Leetcode question on maximizing a sequence in an array