Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions README.md

This file was deleted.

31 changes: 31 additions & 0 deletions linked-list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Linked list

+ [Linked List Cycle II](#linked-list-cycle-ii)

## Linked List Cycle II

https://leetcode.com/problems/linked-list-cycle-ii/

```python
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None

class Solution(object):
def detectCycle(self, _head):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему ты решаешь эту задачу иначе, чем вот здесь https://github.com/Igneaalis/algorithms/pull/21/files

Ты можешь переиспользовать код здесь

tail = curNode = head = _head
while curNode and curNode.next:
tail = tail.next
curNode = curNode.next.next
if tail is curNode:
break
else:
return None
while head is not tail:
tail = tail.next
head = head.next
return head

```