Pergunta de entrevista da empresa Capital One

For the programming question they asked me a LeetCode question of difficulty: Easy