We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
only to look up "data" is not sufficient. "data" can be a lot of times in a list. you need to store and look up for whole object or use a tuple holding (data, next). Together with its "next" it is unique and if you find this again you got a loop --> True
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Cycle Detection
You are viewing a single comment's thread. Return to all comments →
only to look up "data" is not sufficient. "data" can be a lot of times in a list. you need to store and look up for whole object or use a tuple holding (data, next). Together with its "next" it is unique and if you find this again you got a loop --> True