Tech Mahindra Interview Question

Some basic Algorithm and logical reasoning