Solve scheduling and collision problems | J.P. Morgan Interview Question