LendInvest interview question

Just had the code test