Pergunta de entrevista da empresa eBay

I was asked to solve several algorithmic problems mostly about arrays