Domanda di colloquio di Akamai

Find the Town Judge problem. Finished early so I got asked a SQL based question (sorting data)