BNY Interview Question

Asked to write code in hackathon