diff --git a/README.md b/README.md deleted file mode 100644 index 7c3b229..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Algorithms 2019-2020 Python LEETCODE - -Check branches for information. \ No newline at end of file diff --git a/linked-list.md b/linked-list.md new file mode 100644 index 0000000..038f498 --- /dev/null +++ b/linked-list.md @@ -0,0 +1,26 @@ +# Linked list + ++ [Linked List Cycle](#linked-list-cycle) + +## Linked List Cycle + +https://leetcode.com/problems/linked-list-cycle/ + +```python +# Definition for singly-linked list. +# class ListNode(object): +# def __init__(self, x): +# self.val = x +# self.next = None + +class Solution(object): + def hasCycle(self, root): + tail = head = root + while head and head.next: + head = head.next.next + tail = tail.next + if tail is head: + return True + return False + +``` \ No newline at end of file