Aarki Interview Question

Q: Write a function in Python that solves this problem...