Tesla Interview Question

Queries involving joins, window functions and ctes