NextCapital Group interview question

Please do this coding challenge