Capital One interview question

debug some code, basic DSA questions