ONE BCG interview question

Java