Pergunta de entrevista da empresa OfferUp

A logic/problem solving question that needed to be answered. I also wrote some code that would let anybody find the answer with a simple command. It was completed as a discussion through the logic more than a test question.