IBM interview question

Solve an algorithmic problem in Java.