Pergunta de entrevista da empresa Upstox

write a higher order for reduce function in swift