Subex interview question

Basic java