Pergunta de entrevista da empresa IBM

Leetcode medium, also looking at personality.