C Squared Systems interview question

I was asked to solve a common myself join problem.