IBM interview question

java algorithms