Infosys interview question

Java coding question (easy to medium)