Back to course home
0% completed
Vote For New Content
Why the heck is code so long, when it can be written as simple as this?
sharmilasiram
Apr 14, 2024
#class Node: # def __init__(self, value, next=None): # self.val = value # self.next = next class Solution: def findCycleStart(self, head): #TODO Write your code here if head == None or head.next == None: return None slow, fast = head, head while fast != None and fast.next != None: slow = slow.next fast = fast.next.next if slow == fast: slow = head while slow != fast: slow = slow.next fast = fast.next return slow return None
I feel like if you don't refine this code, this course is not even worth the money I am paying
3
0
Comments
Comments
S
sharmilasiram 2 years ago
And list the edge cases! like what to do if there is not a cycle and all