Pregunta de entrevista de RippleHire

Logic based java question