Tata Interview Question

Oops concept