Pergunta de entrevista da empresa Anduril

One Leetcode medium problem and a follow up.