Question d’entretien chez Morgan Stanley

1 mid level difficulty coding question. Java data structure and then SQL based queries, few thread related question.