American Express interview question

Java questions, some logic questions