Pregunta de entrevista de Rakuten

basics question from java and algorithms