FDM Group interview question

Java object oriented problem and leetcode medium problem