Caterpillar interview question

Basic DSA questions and other oops concepts