Pergunta de entrevista da empresa Amazon

Math question which was a flow question, not that difficult once you work through it but don't rush