NextCapital Group interview question

Simple coding exercise available on the web. Doable, if you are smart enough.