Titan Company Interview Question

Difficult SQL queries.