Pergunta de entrevista da empresa Amazon

One DSA coding problem and it was difficult