Pergunta de entrevista da empresa TikTok

write a function that takes an array of integers, and returns the maximum sum of a contiguous subarray.