LeetCode
Keys and Rooms
Click
here
for an explanation.