Pergunta de entrevista da empresa Amazon

SWE leetcode question around easy-medium difficultly.