FlairsTech Interview Question

I was given a problem solving question