Pregunta de entrevista de Upstox

write a higher order for reduce function in swift