BNP Paribas interview question

Some basic SQL and general algo problem qs. Then 3 coding problems.