LeetCode
Find Eventual Safe States
Click
here
for an explanation.