Tech Mahindra Interview Question

Complete explanation on my framework