magicpin Interview Question

sql window function, root cause analysis