Pergunta de entrevista da empresa Amazon

A typical medium level algorithm you’d find on LeetCode or Hackerrank.