Pregunta de entrevista de SAP

Basic SQL, basic Java, basic algorithms (I had 2 problems to solve)