Write SQL using HAVING and window functions | PayPal Interview Question