Mr. Cooper interview question

Problem solving and Advanced SQL