Pregunta de entrevista de FDM Group

Java object oriented problem and leetcode medium problem