Bank of America interview question

Very simple algorithm questions