Pergunta de entrevista da empresa CoverMyMeds

Hacker rank problem mostly. how well you optimise them