Markytics Interview Question

DSA problem using python language