UBS Interview Question

Algo and SQL coding challenge