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.
Cycle Detection
Cycle Detection
Sort by
recency
|
1343 Discussions
|
Please Login in order to post a comment
Python code for Cycle detection
**Works Totally well for all the test cases **
Upvote it if you found it pretty helpful & Do Comment below for any suggestions⛳
Description is BS!
Head refers to the list of nodes 1 -> 2 -> 3 -> 1 -> NULL There is a cycle where node 3 points back to node 1, so return .
Ah??? If there is a cycle then there will be no NULL and it should be like so:
1 -> 2 -> 3 -> 1 -> 2 ... etc
This is not a well written problem. This is bad.
Hacky solution for the lulz: