Wallet Hub interview question

Assignment was given for 2 question