GlobalLogic Interview Question

oops concept, coding round