X interview question

Leetcode hard, some sql questions and some probability questions