Question d’entretien chez Morgan Stanley

puzzles, math, sql question with join, standard c/c++