Detect earliest collision among moving cars | Meta Interview Question