Booking.com interview question

Cycle detection in directed graph