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
|
1304 Discussions
|
Please Login in order to post a comment
My solution in JAVA. Floyd's cycle detection algorithm
using hash
def has_cycle(head): address = set() current = head while current: if current in address: return 1 else: address.add(current) current = current.next return 0
there seems to be an error on main in the javascript node version, temp is being assigned even though is a const variable
JAVA: Here is my resolution for this problem:
This only worked with the first two test cases, I don't understand why it didn't work with the rest, could someone help me please?