Funding Societies interview question

Algorithms and pseudo code