bp interview question

SQL - Joins Python - DP