Interview Bootcamp
Ask Author
Back to course home

0% completed

Vote For New Content
Concise Solution in python.

sid-patel

Aug 23, 2024

class Solution: def findCycleStart(self, head): slow, fast = head, head while fast and fast.next: slow = slow.next fast = fast.next.next // when the two pointers meet, rest anyone pointer back to head and then step one at a time // until they meet again. the point they meet is the starting of the cycle. if slow == fast: slow = head while slow!=fast: slow = slow.next fast = fast.next return slow return None

0

0

Comments
Comments